Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: Time Totaling re-explained

by Rhose (Priest)
on Oct 25, 2001 at 17:03 UTC ( #121438=note: print w/replies, xml ) Need Help??


in reply to Re: Time Totaling re-explained
in thread Time Totaling re-explained

The only comment I would offer is to left pad your minutes with a zero.

#-- Original return "$hours:$mins"; #-- Suggestion return $hours.':'.substr('00'.$mins,-2);

To see the difference, run the supplied sample with times of 5:33 and 4:33.

Update:

return sprintf("%d:%02d",$hours,$mins);

Just as good or better. *Smiles*

Replies are listed 'Best First'.
Re: Time Totaling re-explained
by cLive ;-) (Prior) on Oct 25, 2001 at 20:53 UTC
    Ah yes, good point - TIMTOWTDI, but I think sprintf is more your friend for this:
    return sprintf("%d:%02d",$hours,$mins);
    cLive ;-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2019-08-21 11:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?