| Author |
Comparing two dates
|
M Burke
Ranch Hand
Joined: Jun 25, 2004
Posts: 375
|
|
|
what is the best way to compare two dates? If you have two dates with a year, month and day, and you want to return "true" if date #1 is less than or == to Date #2.
|
 |
Yosi Hendarsjah
Ranch Hand
Joined: Oct 02, 2003
Posts: 164
|
|
You can find the answer in the Java API documentation for java.util.Date class. [ February 14, 2005: Message edited by: Yosi Hendarsjah ]
|
 |
David Harkness
Ranch Hand
Joined: Aug 07, 2003
Posts: 1646
|
|
If you have them as individual integer values (3 each), you can skip creating a Date from them and just do it in an if test. You should reason out what that would look like, but I'll get you started.Any date in 2004 is before every date in 2005.In the same year, earlier months come before later months regardless of day of month.... (I gotta leave something for you to figure out!)
|
 |
Senthil B Kumar
Ranch Hand
Joined: Feb 09, 2004
Posts: 140
|
|
[ February 21, 2005: Message edited by: kolkata prince ]
|
Work like you don't need the money. Love like you've never been hated. Dance like nobody's watching. Sing like nobody's listening. Live like it's Heaven on Earth.
Currently I Reside Here WEBlog
|
 |
David Harkness
Ranch Hand
Joined: Aug 07, 2003
Posts: 1646
|
|
CODE tags! CODE tags! CODE tags! Check out the "Instant UBB Code" buttons below the "Add Reply" button.
|
 |
 |
|
|
subject: Comparing two dates
|
|
|