http://www.perlmonks.org?node_id=977365


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