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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "compare two dates" Watch "compare two dates" New topic
Author

compare two dates

sreedhara satuluri
Greenhorn

Joined: Mar 17, 2005
Posts: 12
My problem is that , i have two datesn string format and i want to compare them.
How can i acquire the result.

This is an urgent question and its solution is required as urgent as possible
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
You can create a DateFormat object with a pattern that matches your string and use that to parse the two date strings into two Date objects, then use compareTo or equals on the two Dates. See if the JavaDoc for those classes is enough to get you going.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Chit Ming Chong
Ranch Hand

Joined: Sep 09, 2004
Posts: 49
You need a Calender object if you don't want to have warnings from the compiler
 
jQuery in Action, 2nd edition
 
subject: compare two dates