• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

dateChooser doesn't add next day in Calendar ?  RSS feed

 
Ranch Hand
Posts: 79
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My code is
 
Bartender
Posts: 3320
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Greenhorn
Posts: 20
Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



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
Posts: 3320
86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!