Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Incrementing the date

 
Jamie Cotton
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hiya all I have



But how do I get date2 to be date increment by 2 days. So if date is 07/04/2005 date 2 should be 09/04/2005
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a Calendar and look at the roll() and add() methods.
 
Mark Mescher
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use GregorianCalendar. Never add millis directly to generate the new date because you will get problems with winter/summer times and so on.
Bye
Mark
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I had posted same kind of Q few days back..

have a look ..

http://www.coderanch.com/t/376264/java/java/Tommorows-date

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic