Parsing unix date with perl
I recently had a need to parse pretty "date" like: Wed Jan 26 19:39:50 PST 2005
I wanted to turn this back into unix time like: 1106797190
I found a wonderful module on cpan Date::Parse that can do this in one function :D
So you could do something like:
perl -MDate::Parse
$date = "Wed Jan 26 19:39:50 PST 2005";
$time = str2time($date);
print "$time\n";
0 Comments:
Post a Comment
<< Home