| Author |
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
|
|
Try: You can check the day with the Calendar.get(Calendar.DAY_OF_MONTH) method. HTH
|
 |
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? hahahahajk. 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
Wanderer
Sheriff
Joined: Jan 30, 2000
Posts: 18652
|
|
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"
Sheriff
Joined: Sep 29, 2000
Posts: 8521
|
|
Fiz, 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. Thanks, Cindy
|
"JavaRanch, where the deer and the Certified play" - David O'Meara
|
 |
 |
|
|
subject: Tomorrow's date
|
|
|