How can I increment a date by one day in Java?

前端 未结 28 1834

I\'m working with a date in this format: yyyy-mm-dd.

How can I increment this date by one day?

28条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-11-21 07:00

    you can use Simple java.util lib

    Calendar cal = Calendar.getInstance(); 
    cal.setTime(yourDate); 
    cal.add(Calendar.DATE, 1);
    yourDate = cal.getTime();
    

提交回复
热议问题