aspose file tools*
The moose likes Java in General and the fly likes dateChooser  doesn't add next day in Calendar ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "dateChooser  doesn Watch "dateChooser  doesn New topic
Author

dateChooser doesn't add next day in Calendar ?

Ganesh Pat
Ranch Hand

Joined: Feb 04, 2012
Posts: 79

My code is
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2280
    
  49
How do you know it's not adding a day, you aren't printing out anything and you a setting 'today' to the constant Calendar.DAY_OF_MONTH and not to the current day.
Try running this:
Jinu Vijay
Greenhorn

Joined: Sep 19, 2011
Posts: 20




For today's date (20/2/2013), the above code returns:
Cal: 20/2/2013
Cal: 31/2/2013
Cal: 1/3/2013

Incrementing the date, auto increments the month too!
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2280
    
  49
Incrementing the date, auto increments the month too!

Only if you use add(..). If you use roll(..) larger fields are not affected.

BTW I would avoid using the Calendar.DATE constant and use Calendar.DAY_OF_MONTH instead. To Calendar they mean exactly the same thing but the Calendar.DAY_OF_MONTH constant name gives a much clearer meaning of what the constant represents.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: dateChooser doesn't add next day in Calendar ?