• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to compare two dates in mm/dd/yyyy format  RSS feed

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"02/11/2013"
I have this date format and i want to check this date is < 05/11/2013
how can i do it???
please send me answer
i am waiting
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

yogesh m gaikwad wrote:"02/11/2013"
I have this date format and i want to check this date is < 05/11/2013
how can i do it???
please send me answer
i am waiting


Hi yogesh,

Welcome to CodeRanch!

Here at CodeRanch, we encourage users to learn on their own - rather than providing ready-made answers.

Coming to your doubt, there are two methods in Date class: after and before. Both method accept a Date object and return boolean result.

So, it you are having two Date objects, then you can easily invoke these methods.

I hope this helps.
 
Java Cowboy
Sheriff
Posts: 16084
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have those dates as strings? Then you'll first want to parse them into Date objects, using java.text.SimpleDateFormat.
 
Cob is sand, clay and sometimes straw. This tiny ad is made of cob:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!