It's not a secret anymore!*
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 Android Security Essentials Live Lessons this week in the Android 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
Don't get me started about those stupid light bulbs.
subject: Dates
Similar Threads
Regular expression to compare numbers
compare two dates thru Calendar
converting to date format
Date comparision
Struts ValidWhen validation