This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Incrementing the date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Incrementing the date" Watch "Incrementing the date" New topic
Author

Incrementing the date

Jamie Cotton
Greenhorn

Joined: Nov 12, 2004
Posts: 16
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

Joined: Apr 14, 2004
Posts: 10336

Use a Calendar and look at the roll() and add() methods.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Mark Mescher
Ranch Hand

Joined: Oct 25, 2004
Posts: 34
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

Joined: Jul 04, 2004
Posts: 978
Hi,

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

have a look ..

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

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Incrementing the date
 
Similar Threads
comparing dates
validating day and month using SimpleDateFormat
error in formatting miliseconds for date objects
How to get past date ?
Comparing two date inputs