File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Date Comparison : 48 hour rule

 
Alan W Morgan
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 657
Clojure Spring VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you review the code posted in your other thread?

http://www.coderanch.com/t/376993/java/java/Date-Comparison
 
Alan W Morgan
Greenhorn
Posts: 23
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, should've checked that first.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic