Computer Science, asked by ishmeetkaur, 2 months ago

Write a program to print the next Date of the given Date.
(Input the date in the format – yyyy-mm-dd and print the next
date also in the same format)

Answers

Answered by tseries12345678901
0

Please specify in which language you want the program.

Here is one I coded in Java

```java

public static String getNextDate(String curDate) {

final SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");

final Date date = format.parse(curDate);

final Calendar calendar = Calendar.getInstance();

calendar.setTime(date);

calendar.add(Calendar.DAY_OF_YEAR, 1);

return format.format(calendar.getTime());

}```

Similar questions