如何查询两个String类型时间之间的所有月份、日期、小时、分钟、秒?
- 内容介绍
- 文章标签
- 相关推荐
本文共计569个文字,预计阅读时间需要3分钟。
java/** * 获取两个日期之间的所有日期 * @param begin 开始日期 * @param end 结束日期 * @return 日期列表 */private static List getBetweenDates(Date begin, Date end) { List dates=new ArrayList(); Calendar calendar=Calendar.getInstance(); calendar.setTime(begin); while (calendar.getTime().before(end) || calendar.getTime().equals(end)) { dates.add(new SimpleDateFormat(yyyy-MM-dd).format(calendar.getTime())); calendar.add(Calendar.DAY_OF_MONTH, 1); } return dates;}
/**
* 获取两个日期之间的所有日期(yyyy-MM-dd)
* @Description TODO
* @param begin
* @param end
* @return
* @author XuJD
* @date 2017-4-1
*/
private static List
private static List
/**
* 获取两个日期之间的有几个小时
* @Description TODO
* @param begin
* @param end
* @return
* @author XuJD
* @date 2017-4-1
*/
private static List
/**
* 获取两个日期之间有几分钟
* @Description TODO
* @param begin
* @param end
* @return
* @author XuJD
* @date 2017-4-1
*/
private static List
/**
* 获取两个日期之间有几秒钟
* @Description TODO
* @param begin
* @param end
* @return
* @author XuJD
* @date 2017-4-1
*/
private static List
本文共计569个文字,预计阅读时间需要3分钟。
java/** * 获取两个日期之间的所有日期 * @param begin 开始日期 * @param end 结束日期 * @return 日期列表 */private static List getBetweenDates(Date begin, Date end) { List dates=new ArrayList(); Calendar calendar=Calendar.getInstance(); calendar.setTime(begin); while (calendar.getTime().before(end) || calendar.getTime().equals(end)) { dates.add(new SimpleDateFormat(yyyy-MM-dd).format(calendar.getTime())); calendar.add(Calendar.DAY_OF_MONTH, 1); } return dates;}
/**
* 获取两个日期之间的所有日期(yyyy-MM-dd)
* @Description TODO
* @param begin
* @param end
* @return
* @author XuJD
* @date 2017-4-1
*/
private static List
private static List
/**
* 获取两个日期之间的有几个小时
* @Description TODO
* @param begin
* @param end
* @return
* @author XuJD
* @date 2017-4-1
*/
private static List
/**
* 获取两个日期之间有几分钟
* @Description TODO
* @param begin
* @param end
* @return
* @author XuJD
* @date 2017-4-1
*/
private static List
/**
* 获取两个日期之间有几秒钟
* @Description TODO
* @param begin
* @param end
* @return
* @author XuJD
* @date 2017-4-1
*/
private static List

