note 80181 deleted from function.date by felipe
| From: | felipe@php.net | Date: | Thu, 03 Jan 2008 18:36:11 +0000 |
| Subject: | note 80181 deleted from function.date by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134722@lists.php.net to get a copy of this message | ||
Note Submitter: Frank Rocker
----
To display an elapsed time interval in human readable format for intervals less than 1 year, I
created this function:
function display_time($time_in_seconds) {
return date("z\d\ H\h\ i\m s\s", ($time_in_seconds - date("Z")));
}
Example:
echo display_time(10591);
0d 02h 56m 31s
The date function is timezone-aware. date("Z") in the function above compensates for the
timezone differential.
Frank
fxrocker from gmail.com