jQuery in Action, 3rd edition
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
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "compare two dates" Watch "compare two dates" New topic

compare two dates

sreedhara satuluri

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
I agree. Here's the link: http://aspose.com/file-tools
subject: compare two dates
It's not a secret anymore!