This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Dates 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 » Beginning Java
Bookmark "Dates" Watch "Dates" New topic
Author

Dates

Giomar Guevara
Ranch Hand

Joined: Oct 18, 2006
Posts: 51
I want to get the difference between 2 dates and get it in hours....

How can I do that?
David Buzatto
Greenhorn

Joined: Jul 16, 2006
Posts: 9
Take a look in the Joda Time API.

Bye!


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." (Fowler)
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Take a look at these JavaWorld articles: Calculating Java dates and Working in Java time : Learn the basics of calculating elapsed time in Java - they do a nice job of explaining Date math in Java.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Dates
 
Similar Threads
I have a doubt in oracle!
display only 2 rows from a recordset size of 10
How get Dates in a particular week Of year
comparing dates
How to get the difference between 2 dates ?