String sBegin = "2004-12-24"; //起始时间
String sCurrent = "";
String sEnd = "2005-1-12"; //终止时间
Calendar calStart = Calendar.getInstance();
calStart.setTime(java.sql.Date.valueOf(sBegin));
Calendar calEnd = Calendar.getInstance();
calEnd.setTime(java.sql.Date.valueOf(sEnd));
calEnd.add(Calendar.DATE, 1);
Calendar calTmp = (Calendar)calStart.clone();//get the copy of the begin date
while(!calEnd.equals(calTmp))
{
System.out.println("year:"+ String.valueOf(calTmp.get(Calendar.YEAR))+",MONTTH:"
+String.valueOf(calTmp.get(Calendar.MONTH+1)
+",DAY;"+String.valueOf (calTmp.get (Calendar.DATE)));
calTmp.add(Calendar.DATE, 1);
}
Calendar 得到的月份要1才行。