On Thu, 20 Jan 2005, Jason Balicki wrote:

> 
> 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 might want to try something like this
--------------------------------------

#/usr/bin/perl

use strict;
use warnings;

#          YYMMDDHHMM
#example:  0501201500
#         MM/DD/YYYY,HH:MM

my $teledate='0501201500';

my($y, $m, $d, $h, $min) = unpack ("A2 A2 A2 A2 A2",$teledate);

$y=$y+2000;

print "$m/$d/$y,$h:$min\n";


-----------------------------------



Owen


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to