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
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: 1507
    
    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: 14150
    
  18

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