Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
yogesh m gaikwad
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
 
Anayonkar Shivalkar
Bartender
Posts: 1557
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.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15484
43
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic