permaculture playing cards*
The moose likes Beginning Java and the fly likes Difference between 2 dates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Difference between 2 dates" Watch "Difference between 2 dates" New topic
Author

Difference between 2 dates

Chinmay Bajikar
Ranch Hand

Joined: Dec 08, 2001
Posts: 159
Hi,
I need to know the difference between 2 date objects in number of days.
Is there any direct api which will help me do this or I have to do this in a roundabout manner?
thanks,
Chinmay


The strength of the Wolf is the pack & the strength of the pack is the wolf....Rudyard Kipling
Nayanjyoti Talukdar
Ranch Hand

Joined: Feb 12, 2002
Posts: 71
There is no any direct implementation in API.
U can do that using GregorianCalendar.
----------
Nayan
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Take a look at the TimeSpan class that I wrote:
http://www.coderanch.com/t/393160/java/java/calculate-number-days-between-two


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
 
 
subject: Difference between 2 dates
 
Similar Threads
Dates
Difference between Object and Instance
NX: choices.txt (Lazy bum vs. Please shut him up!)
Layout again
How to get the difference between 2 dates ?