wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Subtracting Dates in JAVA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Subtracting Dates in JAVA" Watch "Subtracting Dates in JAVA" New topic

Subtracting Dates in JAVA

Sam Drake
Ranch Hand

Joined: Jun 05, 2003
Posts: 33
Can anybody give me a code snippet to subtract dates in JAVA? The idea is to get the number of days between any 2 dates.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
How about getting the difference in milliseconds:
d1.getTime() - d2.getTime();
Jason Menard

Joined: Nov 09, 2000
Posts: 6450
Check out this thread.
I agree. Here's the link: http://aspose.com/file-tools
subject: Subtracting Dates in JAVA
Similar Threads
Passing Date from HTML Form to JSP/Action Handler
caculating the difference between dates
amount of days ????
Reformating date
Date calculation