wood burning stoves 2.0*
The moose likes JSP and the fly likes Rolling Dates With java.util.GregorianCalendar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Rolling Dates With java.util.GregorianCalendar" Watch "Rolling Dates With java.util.GregorianCalendar" New topic
Author

Rolling Dates With java.util.GregorianCalendar

Kawika King
Greenhorn

Joined: Dec 18, 2002
Posts: 7
I have a combo box that is populated with dates, starting with today and adding 14days. Ex.
Dec 18, 2002
Dec 19, 2002
etc..
Anyone know how would I change the year so that I can roll over to 2003 or 2004?
Dec 31, 2002
Jan 1, 2003 ???
Thanks
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179


If you use this code, you'll add 1 year.

This will add 2 month. If more then a year it will automatic add 1 to the year.

This will add 3 days. If more then a month, it will automatic add 1 to the month, and if more then a year it will automatic add 1 to the year.
Lap year will also automatic be checked.
Rene
[ December 19, 2002: Message edited by: Rene Larsen ]

Regards, Rene Larsen
Dropbox Invite
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rolling Dates With java.util.GregorianCalendar