java 遍历时间段的方法

时间:2025-03-28 19:16:18
import ; import ; import ; import ; import ; public class IterateDate { public static void main(String[] args) throws ParseException { Calendar c = (); DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd"); //开始时间必须小于结束时间 Date beginDate = ("2014-05-01"); Date endDate = ("2014-06-25"); Date date = beginDate; while (!(endDate)) { (date); (date); (, 1); // 日期加1天 date = (); } } }