import javatextSimpleDateFormat;
import javautilArrayList;
import javautilCalendar;
import javautilDate;
import javautilList;
public class Du2 {
public static void main(String[] args) {
int date1 = 20111001;
int date2 = 20111101;
List<Date> list = getJulianDate(date1, date2);
for(Date date: list){
Systemoutprintln(datetoLocaleString());
}
}
private static List<Date> getJulianDate(int date1, int date2) {
Calendar cal = CalendargetInstance();
calset(CalendarYEAR, date1 / 10000);
calset(CalendarMONTH, date1 /100 % 100 - 1);
calset(CalendarDATE, date1 % 100);
final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
List<Date> list = new ArrayList<Date>();
while(IntegerparseInt(sdfformat(calgetTime())) <= date2){
listadd(calgetTime());
caladd(CalendarDATE, 1);
}
return list;
}
}
--------------testing
Oct 1, 2011 5:57:54 PM
Oct 2, 2011 5:57:54 PM
Oct 3, 2011 5:57:54 PM
Oct 4, 2011 5:57:54 PM
Oct 5, 2011 5:57:54 PM
Oct 6, 2011 5:57:54 PM
Oct 7, 2011 5:57:54 PM
Oct 8, 2011 5:57:54 PM
Oct 9, 2011 5:57:54 PM
Oct 10, 2011 5:57:54 PM
Oct 11, 2011 5:57:54 PM
Oct 12, 2011 5:57:54 PM
Oct 13, 2011 5:57:54 PM
Oct 14, 2011 5:57:54 PM
Oct 15, 2011 5:57:54 PM
Oct 16, 2011 5:57:54 PM
Oct 17, 2011 5:57:54 PM
Oct 18, 2011 5:57:54 PM
Oct 19, 2011 5:57:54 PM
Oct 20, 2011 5:57:54 PM
Oct 21, 2011 5:57:54 PM
Oct 22, 2011 5:57:54 PM
Oct 23, 2011 5:57:54 PM
Oct 24, 2011 5:57:54 PM
Oct 25, 2011 5:57:54 PM
Oct 26, 2011 5:57:54 PM
Oct 27, 2011 5:57:54 PM
Oct 28, 2011 5:57:54 PM
Oct 29, 2011 5:57:54 PM
Oct 30, 2011 5:57:54 PM
Oct 31, 2011 5:57:54 PM
Nov 1, 2011 5:57:54 PM
欢迎分享,转载请注明来源:品搜搜测评网