in reply to Fast(er) date parsing
use Time::Local; my %months = ( Jan=> 0, Feb=> 1, Mar=> 2, Apr=> 3, May=>4, Jun=> 5, Jul=> 6, Aug=> 7, Sep=> 8, Sep=> 8, Oct=> 9, Nov=> 10, Dec= +> 11); # Parse the date: Fri Jun 30 11:07:39 2000 my ($day, $month, $mday, $time, $year)=split(" ", $d); my ($hour,$min,$sec)=split(":",$time); my $result = timelocal($sec,$min,$hour,$mday,$months{$month},$year);
I'd prefer not having to use any module but this seems reasonable
The reason i need this is to go through some log files and
print a summary of the events that happened in the
past 24 hours.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Answer: Fast(er) date parsing
by I0 (Priest) on Dec 29, 2000 at 17:34 UTC |