Time::Piece rocks at this kind of stuff.
If you don't supply a year, T::P picks 1970:
use Time::Piece; my $date = localtime->strptime("Thu Jan 8 07:01:01",'%a %b %d %T'); print $date . "\n";
You can default to the current year (or any year for that matter) like so:
use Time::Piece; my $year = localtime->year; my $date = localtime->strptime("Thu Jan 8 $year 07:01:01",'%a %b %d %Y + %T'); print $date . "\n";
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Parsing a date/time string into a UNIX timestamp
by jeffa
in thread Parsing a date/time string into a UNIX timestamp
by hijinks
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |