RE: Comparing Dates
by Steve Howard other posts by this author
Nov 26 2007 8:04PM messages near this date
Comparing Dates
|
RE: Comparing Dates
Remove the dashes and compare them numerically, or with a string compare. Be sure it is yyyy
-mm-dd and not yyyy-m-d, though. It works out like this:
2007-12-23 comes well after 2005-01-01, so comparing 20071223 > 20050101.
A string compare works even without removing the dashes. Removing the dashes lets you compar
e either for == or for eq.
Steve Howard
From: perl-win32-database-bounces@[...].com [mailto:perl-win32-database-bounces@[...].com] O
n Behalf Of Jonathan Dudson
Sent: Monday, November 26, 2007 2:39 PM
To: perl-win32-database@[...].com
Subject: Comparing Dates
Hi Peeps hopefully someone can point me in the right direction.
I have a couple of dates I have stored in a mysql DB stored in the following format yyyy-mm-
dd, how in a Perl script how can I test if date 1 is less than or equal to date 2.
Any help would be greatly appreciated.
Jay
Thread:
Jonathan Dudson
Steve Howard
Justin Allegakoen
|