aspose file tools*
The moose likes Beginning Java and the fly likes add days to date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "add days to date" Watch "add days to date" New topic
Author

add days to date

Fernando Dominguez
Ranch Hand

Joined: Sep 01, 2006
Posts: 104

Hello,

Is there any simple way to add to a Date object 3 days.

I trie to get the milisecons from the date and then create a new date with the miliseconds from the original date adding the miliseconds of threee day but I think there would be something easier.

Thnaks
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1


Use Calendar class, It has roll() and add() methods , which helps to add() specific field by some value you want. The fields are like DATE, MONTH , etc..

Have look at Calendar class APIfor detailed story !


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
 
Don't get me started about those stupid light bulbs.
 
subject: add days to date