Title: Message
 > I would like to re-format it to be more readable, something like this:

 > 15:02:23 JUN 09 2003

 

 try this --

 

%monthnames  = ('00', 'Nul',
                '01','Jan',
                '02','Feb',
                '03', 'Mar',
                '04','Apr',
                '05','May',
                '06','Jun',
                '07','Jul',
                '08','Aug',
                '09','Sep',
                '10','Oct',
                '11','Nov',
                '12','Dec');

 

my $in = "20030609150223.000000-240";
# expected output:  15:02:23 JUN 09 2003


 my  $nustring = substr($in,8,2) . ":" .
           substr($in,10,2) . ":" .
            substr($in,12,2) . " " .
            $monthnames{substr($in,4,2)} . " " .
            substr($in,6,2) . " " .
            substr($in,0,4); 

 

print "input:   " . $in . "\n" .
      "output:  " . $nustring . "\n";

Glen

 

Reply via email to