File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Dates Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Dates" Watch "Dates" New topic


vin Hari
Ranch Hand

Joined: Nov 16, 2006
Posts: 161
Hi all,
please tell me how to compare dates like
12/12/2006 assume as todays date and 10/12/2006 as another date
hoow to compare these dates.
Joice Jose

Joined: Jun 29, 2005
Posts: 14
Use java.util.Date class to compare dates. This class provides methods such as compareTo(), after(), before(), etc.
Chengwei Lee
Ranch Hand

Joined: Apr 02, 2004
Posts: 884
Look into the Java API. Take a look at the following classes: Calendar, GregorianCalendar & Date. You need to know that when doing date comparison, its not really just the day component, there's also the time component, if it is to be disregarded, you have to set the time component to be the same.

SCJP 1.4 * SCWCD 1.4 * SCBCD 1.3 * SCJA 1.0 * TOGAF 8
I agree. Here's the link:
subject: Dates
It's not a secret anymore!