problem with .roll(Calendar.DAY_OF_YEAR, 365 );
Posted on 2004-09-17
Hi, im using the following code to store a future date in a string, the problem is that when the date goes into a new year the current year remains.
So if I "roll" past december of this year, the year stored in the date will be 2004 instead of 2005. How can I resolve this and changing my code as little as possible. Thanks
Calendar date = Calendar.getInstance();
finishDate.roll(Calendar.DAY_OF_YEAR, 365 );
String Date = sdf.format(date.getTime());