Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
my $xcltime = "19:45:34"; # It should print 7:45 PM my $xcltime2 = "23:35:14"; # It should print 11:35 PM if (($xcltime=~/(\d{1,2}):(\d{1,2}):(\d{1,2})/)||($xcltime2=~/(\d{1,2} +):(\d{1,2}):(\d{1,2})/)) { my $h1=$1;my $m2=$2; my $s3=$3; print "$h1,$m2,$s3<br>"; if($h1=~/13||14||15||16||17||18||19||20||21||22||23||24/) { $h1=~s/13/1/; $h1=~s/14/2/; $h1=~s/15/3/; $h1=~s/16/4/; $h1=~s/17/5/; $h1=~s/18/6/; $h1=~s/19/7/; $h1=~s/20/8/; $h1=~s/21/9/; $h1=~s/22/10/; $h1=~s/23/11/; $h1=~s/24/12/; $xcltime=$h1.":".$m2." PM"; $xcltime2=$h1.":".$m2." PM"; print "<b>$xcltime - $xcltime2</b><br>"; }else {$xcltime = $xcltime."AM"; print "<b>$xcltime - $xcltime2 +</b><br>";}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Time transformation
by eieio (Pilgrim) on Sep 03, 2004 at 13:24 UTC | |
by Anonymous Monk on Sep 03, 2004 at 13:30 UTC | |
|
Re: Time transformation
by periapt (Hermit) on Sep 03, 2004 at 13:08 UTC | |
|
Re: Time transformation
by Eimi Metamorphoumai (Deacon) on Sep 03, 2004 at 13:11 UTC | |
|
Re: Time transformation
by Arunbear (Prior) on Sep 03, 2004 at 13:13 UTC | |
|
Re: Time transformation
by lestrrat (Deacon) on Sep 03, 2004 at 13:08 UTC | |
|
Re: Time transformation
by japhy (Canon) on Sep 03, 2004 at 16:04 UTC |