Hi,
I've got a phone record that keeps the date and time in the following format:
YYMMDDHHMM example: 0501201500
So, I've written the following to convert it to the format:
MM/DD/YYYY,HH:MM example: 01/20/2005,15:00
You can use one of the Date modules that understand ISO format, like DateTime. Or you do something like:
my $date_str = '0501201500'; my @date = $date_str =~ /\G\d\d/g; my $date_fmt = sprintf( '%s/%s/%s, %s:%s', @date[1,2,0,3,4] );
see `perldoc perlre` & `perldoc perlretut` for info on using \G and /g in regexps in array context. see `perldoc -f sprintf` for info on the C<sprintf> builtin.
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>