aspose file tools*
The moose likes Beginning Java and the fly likes difference between two dates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "difference between two dates" Watch "difference between two dates" New topic
Author

difference between two dates

shalini gnana
Ranch Hand

Joined: Sep 18, 2007
Posts: 189
I have dates in an arraylist...How can i find the difference between two dates?
Daesung Park
Ranch Hand

Joined: Mar 22, 2007
Posts: 68
I can't catch your question exactly.
To check if two dates are identical, you can use compareTo(Date other) method and see if it returns 0.
You can get difference (miliseconds) between date1 and date2 from date1.getTime()-date2.getTime().
[ February 14, 2008: Message edited by: Daesung Park ]

Daesung Park

BLOG
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

If you need the difference in days, please use the Search optionality. I've given answers to that same question in at least 3 different threads.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between two dates