i hav String date, and I want the insert date to be 1, and it should be loopback by the end of the month. as an example, if I take November 2010, it should take 30 days. if I take December 2010, it should take 31 days. my code is shown below ......
String date="12/01/2010";
String incDate;
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
Calendar c = Calendar.getInstance();
c.setTime(sdf.parse(date));
for(int co=0; co<30; co++){
c.add(Calendar.DATE, 1);
incDate = sdf.format(c.getTime());
}
source
share