File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes how to compare two dates in mm/dd/yyyy format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to compare two dates in mm/dd/yyyy format" Watch "how to compare two dates in mm/dd/yyyy format" New topic
Author

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

yogesh m gaikwad
Greenhorn

Joined: Dec 28, 2011
Posts: 12
"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

Joined: Dec 08, 2010
Posts: 1502
    
    5

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.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Do you have those dates as strings? Then you'll first want to parse them into Date objects, using java.text.SimpleDateFormat.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to compare two dates in mm/dd/yyyy format
 
Similar Threads
convert date in appropriate format
how to Calculate fiscal month if start year and end date is given using JAVA
how to retreive date
Independently configure date format for XML/JSON serialization
getting wrong values using matcher.group()