File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
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: 102

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]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: add days to date