Re: How to count time in php
| From: | Stephan Ahonen | Date: | Mon, 22 Jan 2001 23:44:29 +0000 |
| Subject: | Re: How to count time in php | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-36120@lists.php.net to get a copy of this message | ||
{code snipped}
You could probably simplify this a bit with mktime(). The syntax is
mktime(hours, minutes, seconds):
$minsec = explode(":", $time);
$numsecs += mktime(0, $minsec[0], $minsec[1]);
That'll give you the number of seconds. Then at the end, you can say:
echo(floor($totalseconds / 60) . " minutes.");
to get the total number of minutes. Use ceil() instead of floor() if you
want to round up instead of down, or just echo((int)$totalseconds); to round
to the nearest integer.
Sig for a Day
Stephan Ahonen, ICQ 491101
"That's very funny Scotty, now beam down my clothes!"
Come back tomorrow for a different sig!
Backspace a single "s" to reply by email