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

Difference Between Dates

 
Naadir Peterson
Ranch Hand
Posts: 37
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the easiest way to calculate the difference, in hours, between two Dates?
eg : 12 December 2004 - 15:42 pm and 18 December 2004 - 11:36 am
 
Joel McNary
Bartender
Posts: 1824
Eclipse IDE Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Date has a .getTime() method, which returns the milliseconds representation of the time. calculate the millisecond difference, then divide by 3600000 to get difference in hours.
 
sreelesh kumar
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tell me how to convert 24jan2004 to 24/01/2004
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The answer (or at least a hint) is with your post. Best not to cross post, its just confusing.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic