Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Increase the date by one

I have date and time in the format of yyyy-MM-dd:HH:mm I want to increase the dd by one i.e 2013-10-24:11:20 to 2013-10-25:11:20

    SimpleDateFormat mSDF = new SimpleDateFormat("yyyy-MM-dd:HH:mm");
    time = mSDF.format(calSet.getTime());//calset in my calendar instance 

I don't know what exactly my time/date is .I only know that I have to increase date by one for time variable

like image 398
Shakeeb Ayaz Avatar asked Dec 08 '22 11:12

Shakeeb Ayaz


1 Answers

Use calendar

Calendar cal=Calendar.getInstance();
cal.setDate(yourdate); // pass parsed Date object
cal.add(Calendar.DATE, 1);
cal.getTime(); // here you will get your date
like image 130
Antoniossss Avatar answered Dec 11 '22 10:12

Antoniossss