Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

compare two dates

 
sreedhara satuluri
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chit Ming Chong
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need a Calender object if you don't want to have warnings from the compiler
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic