aspose file tools*
The moose likes Java in General and the fly likes Tomorrows 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 » Java in General
Bookmark "Tomorrows date" Watch "Tomorrows date" New topic
Author

Tomorrows date

Pam Theod
Greenhorn

Joined: Apr 19, 2006
Posts: 14
Hi All,
I have a need to get tomorrows date with time of 23.59 and check the date the user enters in the GUI is not > tomorrow midnight. How do I get tomorrows date.

Thanks in advance.

p
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196


Then compare this Date object with the parsed Date object from the user.
How you parse the date from the user depends on how the user is to enter
the date.
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, 1);
c.set(Calendar.HOUR, 23);
c.set(Calendar.MINUTE, 59);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);


There is no emoticon for what I am feeling!
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18167
    
    8

It would be better to useOtherwise you get code that works differently in the afternoon and in the morning. This is coming from somebody who was personally burned by this feature.
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Woops you're right, don't want to get burned like that either.
Pam Theod
Greenhorn

Joined: Apr 19, 2006
Posts: 14
Thanks to everyone! I have this working now.

P pro
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Tomorrows date
 
Similar Threads
Tommorows date
One liner for getting tomorrows date in mm/dd/yyyy format.
Very Urgent : Fututre Date validation using struts validation
Today(Yes), Tomorrow(No), Date realated problem.
scw.js calender widget