Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Conversion of Time

by Ratazong (Prior)
on Jun 20, 2012 at 14:35 UTC ( #977365=note: print w/ replies, xml ) Need Help??


in reply to Conversion of Time

You could also do it by hand, using a regex to extract the relevant info from your input-string and some hash-lookup to translate the month to a number:

my %convert = ( "Jan" => "01", "Feb" => "02", "Mar" => "03", "Jun" => +"06" ,); # ... you get the idea my $in = "Fri Jun 16 18:04:03 2012"; $in =~ /.*?\s(\w\w\w)\s(.*)$/; my $out = $convert{$1} . " " . $2;

HTH, Rata


Comment on Re: Conversion of Time
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://977365]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2014-09-21 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (175 votes), past polls