获得两个时间段内的分钟,小时,日期

package com.becoda.bkms.common.util;

import java.beans.PropertyEditorSupport;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;


public class DateUtil extends PropertyEditorSupport {

	/**
	 * 返回两个时间段之间的所有日期 
	 * @param beginDate
	 * @param endDate
	 * @return
	 * @throws ParseException
	 * @throws java.text.ParseException
	 */
	public static List<String> getDatesBetweenTwoDate(String beginDate,
			String endDate) throws ParseException, java.text.ParseException {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		List<String> lDate = new ArrayList<String>();
		lDate.add(beginDate);// 把开始时间加入集合
		Calendar cal = Calendar.getInstance();
		// 使用给定的 Date 设置此 Calendar 的时间
		cal.setTime(sdf.parse(beginDate));
		boolean bContinue = true;
		while (bContinue) {
			// 根据日历的规则,为给定的日历字段添
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值