Hi,

my ($sec, $min, $hour, $mday, $mon, $year) = localtime(time());
$year += 1900;
$year -= 1; #if you want the last year
my @months = qw(01 02 03 04 05 06 07 08 09 10 11 12);
my $time = "$year-$months[$mon]-$mday";

Note: I don't know if Perl will put 01, 02, 03, ... for the first days.
Perhaps it will put just 1, 2, 3... and you might need to change this a
little.

Teddy,
Teddy's Center: http://teddy.fcc.ro/
Email: [EMAIL PROTECTED]

----- Original Message -----
From: "Mad Hatter" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 21, 2003 7:14 AM
Subject: Date


I am writing a cgi script to run as a cron job.  when
it runs i need the date of 'one year ago today' in the
format 'YYYY-MM-DD' to be stored in a variable to be
used later in the script.  I am about as dumb as wet
dirt when it comes to cgi.  Can someone please help me
with this?


Thanks!

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to