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 ;-)