note 47771 added to function.time
| From: | florent at arpact dot org | Date: | Mon, 29 Nov 2004 14:40:46 +0000 |
| Subject: | note 47771 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-81152@lists.php.net to get a copy of this message | ||
a function that takes a seconds duration and returns a human formatted duration (days, hours,
minutes). Usefull when you have to calculate a duration after a timestamp difference.
function duration($duration) {
$jours = floor(($duree/86400));
$duration = $duration % 86400;
$heures = floor(($duration/3600));
$duration = $duration % 3600;
$minutes = floor(($duree/60));
$duration = $duration % 60;
printf('%dj %02dh %02dmin',$jours,$heures,$minutes);
}
----
Manual Page -- http://www.php.net/manual/en/function.time.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47771
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47771&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47771&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47771&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47771&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47771&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47771&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47771&report=yes
Search -- http://master.php.net/manage/user-notes.php