RE: Comparing Dates
by Justin Allegakoen other posts by this author
Nov 26 2007 3:29PM messages near this date
RE: Comparing Dates
|
Anyone still monitor?
--------8<------------
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.
--------8<------------
Since the dates are already in yyyy/mm/dd format using Date::Calc would be the easiest:-
D:\Perl\Programs> perl
use strict;
use warnings;
use Date::Calc qw( Delta_Days );
print Delta_Days(2006, 12, 25, 2007, 12, 25);
^D
365
D:\Perl\Programs>
But why not put the onus on the sql server by using a datediff? Typically sql servers are ab
le to handle those type of transactions with less resources.
Just in
_______________________________________________
Perl-Win32-Database mailing list
Perl-Win32-Database@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Jonathan Dudson
Steve Howard
Justin Allegakoen
|