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 Java 8 in Action this week in the Java 8 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: 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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: add days to date
 
Similar Threads
Problem with age script
Milliseconds to date conversion
timestamp
delete logfiles that are older than 3 months
dateformatter...