*
The moose likes Java in General and the fly likes Add 1 day to a date? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Add 1 day to a date?" Watch "Add 1 day to a date?" New topic
Author

Add 1 day to a date?

myron schabe
Greenhorn

Joined: Aug 21, 2002
Posts: 19
How do I add just one day to a Date object?
Thanks
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61315
    
  66

Do a search through these forums. This topic has been covered numerous times, and quite recently as well.
hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
I didn't try compiling this but:
GregorianCalendar cal = new GregorianCalendar()
cal.add(Calendar.DAY_OF_MONTH, 1);
Date d = cal.getTime();
If you have your own Date object perhaps passed in as a parameter then you can set the time:
 
Consider Paul's rocket mass heater.
 
subject: Add 1 day to a date?