Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Time string with addition

by moggs (Sexton)
on Jan 05, 2012 at 16:34 UTC ( [id://946436]=note: print w/replies, xml ) Need Help??


in reply to Time string with addition

The modulo operator will be your key here:

$in = 391; $hour = sprintf("%02d", int($in / 3600)); $min = sprintf("%02d", int($in / 60)); $sec = sprintf("%02d", $in % 60); print "$in .. $hour:$min:$sec\n";

However, I agree with the idea of letting SQL handle the complexities of dates and times - being as it's in use anyway.

Moggs

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found