Correction:  That line should be:

my $perlTime = timelocal("01","01","01",$day,$month - 1,$year);
                                             ^^^^^^^^^^


-----Original Message-----
From: Timothy Johnson 
Sent: Friday, December 02, 2005 12:10 PM
To: 'Rafael Morales'; beginners@perl.org
Subject: RE: Convert date to timestamp


Here's an example:

##################################

use strict;
use warnings;
use Time::Local;

my $textTime = "2005-09-01";
my ($year,$month,$day) = split(/-/,$textTime);

my $perlTime = timelocal("00","00","00",$day,$month,$year);

print "Time:                     $textTime\n";
print "Perl Time:                $perlTime\n";
print "Localtime from Perl Time: ".localtime($perlTime)."\n";

###################################




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to