C
clearguy02
Hi all,
I have the below script ready to change a time stamp from
15-Sep-04.01:03 to 2004-09-15 01:03:00.
===================================
$date = '15-Sep-04.01:03';
%months = qw(January 1 February 2 March 3 April 4 May 5 June 6 July 7
August 8 September 9 October 10 November 11 December 12);
$month_lookup = join '|', keys %months;
if ( $date =~ /(\d+)-($month_lookup)-(\d+)\.(\d+)\d+)/ )
{
$finalDate = sprintf ("20%02d-%02d-%02d %02d:%02d:00\n", $3,
$months{$2}, $1, $4, $5);
}
print "$finalDate";
====================================
Now my problem is that the $date variable might have 15-Sep-04.01:03 or
15-Sept-04.01:03 or 15-September-04.01:03 (month will have a range from
minumum first three chanracters to the whole month name).
then how can I make sure that I can translate either Sep or Sept or
September in to 09 in the final output?
Thanks in advance,
John.
I have the below script ready to change a time stamp from
15-Sep-04.01:03 to 2004-09-15 01:03:00.
===================================
$date = '15-Sep-04.01:03';
%months = qw(January 1 February 2 March 3 April 4 May 5 June 6 July 7
August 8 September 9 October 10 November 11 December 12);
$month_lookup = join '|', keys %months;
if ( $date =~ /(\d+)-($month_lookup)-(\d+)\.(\d+)\d+)/ )
{
$finalDate = sprintf ("20%02d-%02d-%02d %02d:%02d:00\n", $3,
$months{$2}, $1, $4, $5);
}
print "$finalDate";
====================================
Now my problem is that the $date variable might have 15-Sep-04.01:03 or
15-Sept-04.01:03 or 15-September-04.01:03 (month will have a range from
minumum first three chanracters to the whole month name).
then how can I make sure that I can translate either Sep or Sept or
September in to 09 in the final output?
Thanks in advance,
John.