On Tue, 07 Aug 2007 22:47:38 -0700, timbo wrote:
> Is it possible to pass timelocal a parameter that's already the exact
> scalar output of localtime's format "Mon Jan 10 04:30:30 2007"?
> 
> I know the perlfunc documentations for timelocal indicates that
> arguments are in the form of ...
> 
> timelocal($seconds, $minutes, $hours, $day, $month, $year)
> 
> but I have a logfile with the above time format & want to know if
> there's an easier way of reading that entry & pass it to timelocal so
> as to get the epoch time.

I would be lazy and do:

use Date::Parse;   # From CPAN

# ... read logfile, get timestamp in $datetime

my $epoch = str2time( $datetime );

-- 
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/


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


Reply via email to