The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Date Comparison : 48 hour rule Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Date Comparison : 48 hour rule" Watch "Date Comparison : 48 hour rule" New topic

Date Comparison : 48 hour rule

Alan W Morgan

Joined: Apr 18, 2005
Posts: 23
Sorry if this has been asked before but had a search and couldn't find it.

How are you guys checking 48 hour rule ?

My first thought was take date (in form yyyy/mm/dd) and create a GregorianCalendar.
Now take current date and do same.
Call getTimeInMillis() on both and compare.
As long as current is before and less than 2 days worth of milliseconds its ok.

But I don't really like this solution.
Plus not sure what time of day is defaulted to if you create a GregorianCalendar with just year, month, day.

Thoughts ?
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Did you review the code posted in your other thread?

Alan W Morgan

Joined: Apr 18, 2005
Posts: 23
Sorry, should've checked that first.
I agree. Here's the link: http://aspose.com/file-tools
subject: Date Comparison : 48 hour rule
Similar Threads
EarlyBirds 1.3.2 48 hour rule
URLyBird : 48 hours rule enforced
changing Date available when making booking
48 hours rule, pls recomment
NX UyB: Booking fails, then what?