in reply to Subtracting certain number of days from current date.
I don't know about the efficiency but here is how i would write it, (ignoring the CGI part).
use strict; use warnings; use Date::Calc qw(Delta_Days Decode_Date_US Today); my $date1 = '1/1/2010'; # Supose date is in US format my ( $year , $month , $day ) = Today(); my ( $year1, $month1, $day1 ) = Decode_Date_US($date1); my $dd = Delta_Days( $year1, $month1, $day1, $year, $month, $day ); print "There were $dd days between Today and $date1\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Subtracting certain number of days from current date.
by keszler (Priest) on Feb 03, 2010 at 20:26 UTC |