Java: Customize adding 1 month to the current date

cluless

New Member
I've read around and basically I've figured out that the Calendar object is capable of adding 1 month to a date specified by using something like:\[code\]Calendar cal = Calendar.getInstance();cal.add(Calendar.MONTH, 1);\[/code\]Although I don't like its behavior whenever the date is on either the 30 or 31. If ever I add 1 month to 01/31/2012, the output becomes 02/29/2012. When I add 1 more month, it becomes 03/29/2012.Is there anyway I can force 02/29/2012 to become 03/01/2012 automatically? Basically this is what I want to happen:Default date: 01/31/2012Add 1 month: 03/01/2012Add 1 more month: 03/31/2012
 
Back
Top