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";

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

-----Original Message-----
From: Rafael Morales [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 02, 2005 12:01 PM
To: Timothy Johnson; beginners@perl.org
Subject: RE: Convert date to timestamp

I can`t find the way for do it with Time::Local, could you explain me please :)


----- Original Message -----
From: "Timothy Johnson" <[EMAIL PROTECTED]>
To: "Rafael Morales" <[EMAIL PROTECTED]>, beginners@perl.org
Subject: RE: Convert date to timestamp
Date: Fri, 2 Dec 2005 11:39:23 -0800

> 
> 
> Personally I like Time::Local for this kind of calculation, but 
> there are some Date:: modules out there that can do it too.
> 
> -----Original Message-----
> From: Rafael Morales [mailto:[EMAIL PROTECTED]
> Sent: Friday, December 02, 2005 11:23 AM
> To: beginners@perl.org
> Subject: Convert date to timestamp
> 
> Hi list.
> 
> I have two dates in format YYYY-MM-DD for example ( 2005-09-01), 
> but I need to pass them to timestamp format, how do I do it ???.
> I tried with time, localtime, gmtime, but I canĀ“t.
> 
> Thanks.
> 
> 
> 
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>


-- 
_______________________________________________
Get your free email from http://mymail.bsdmail.com


--
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