Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Time transformation

by lestrrat (Deacon)
on Sep 03, 2004 at 13:08 UTC ( [id://388262]=note: print w/replies, xml ) Need Help??


in reply to Time transformation

How about this. I'd rather look for some module to do it, though...

my @times = qw(7:45:34 19:45:34 23:34:14); foreach my $t (@times) { if ($t =~ /^(\d?\d):(\d?\d):\d?\d$/) { my $ampm = "AM"; my ($h, $m) = ($1, $2); if ($h > 12) { $h -= 12; $ampm = "PM"; } print "$h:$m $ampm\n"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://388262]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-19 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found