note 47771 deleted from function.time by aidan

From: Date: Sat, 08 Oct 2005 01:04:26 +0000
Subject: note 47771 deleted from function.time by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-96620@lists.php.net to get a copy of this message
Note Submitter: florent at arpact dot org ---- 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); }

« previous php.notes (#96620) next »