File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
add days to date
Joined: Sep 01, 2006
Jan 22, 2009 02:44:20
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.
Joined: Feb 19, 2008
Jan 22, 2009 02:52:03
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 API
for detailed story !
[Freelance Web Designer]
[and "Rohan" is part of my surname]
It is sorta covered in the
JavaRanch Style Guide
subject: add days to date
Milliseconds to date conversion
delete logfiles that are older than 3 months
Problem with age script
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014