add more than 30 days with Calendar's add() method in Java

Posted by Haes on Stack Overflow See other posts from Stack Overflow or by Haes
Published on 2010-03-24T07:52:14Z Indexed on 2010/03/24 7:53 UTC
Read the original article Hit count: 276

Filed under:
|

Hi,

I'm not quite sure what field to use when adding more than 30 days to a Java Calendar object. Is there any difference in between Calendar.DAY_OF_MONTH and Calendar.DAY_OF_YEAR?

Example:

GregorianCalendar d = new GregorianCalendar();
d.add(Calendar.DAY_OF_YEAR, 90);

vs

GregorianCalendar d = new GregorianCalendar();
d.add(Calendar.DAY_OF_MONTH, 90);

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about calendar