File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Tomorrow's date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Tomorrow Watch "Tomorrow New topic

Tomorrow's date

Md Fizal
Ranch Hand

Joined: Dec 23, 2002
Posts: 61
Can anyone gimme the piece of code in Java to get the tomorrow's date?
Juanjo Bazan
Ranch Hand

Joined: Feb 04, 2002
Posts: 231

You can check the day with the Calendar.get(Calendar.DAY_OF_MONTH) method.
Chris Treglio
Ranch Hand

Joined: Jun 18, 2001
Posts: 64
yeah, but I don't think I can get to it today. Do you mind if I send it tomorrow?
I think you're looking for Calendar.roll(Calendar.DAY_OF_MONTH, true).
Md Fizal
Ranch Hand

Joined: Dec 23, 2002
Posts: 61
I got it. Thanks Juanjo and Chris
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
Instead try
Calendar.add(Calendar.DATE, 1);
The difference is noticeable if the date is at the end of the month, like Jan 31. The roll() method will take you to Jan 1, while the add() method takes you to Feb 1.

"I'm not back." - Bill Harding, Twister
Arun Boraiah
Ranch Hand

Joined: Nov 28, 2001
Posts: 233
Try this also.
Date dt = new Date(System.currentTimeMillis() + (24*60*60*1000) );

Sharing is learning
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Please change your name to be compliant with JavaRanch's naming policy. It should not be obviously fictitious.
Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name.
You can change your name: here.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: Tomorrow's date
jQuery in Action, 3rd edition