Re: How to convert seconds to days, hours, minutes & seconds?
| From: | Jason Morehouse | Date: | Tue, 18 Jun 2002 00:36:21 +0000 |
| Subject: | Re: How to convert seconds to days, hours, minutes & seconds? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-102625@lists.php.net to get a copy of this message | ||
<?
print sprintf("%d:%02d:%02d",$seconds/3600,($seconds/60)%60,$seconds%60);
?>
Should do the trick.
-J
On Tue, 18 Jun 2002 10:46:54 +1200, Fargo Lee wrote:
> Hi, if I have a variable containing a number of seconds what function
> would I use to output something like ...
>
> 13 Hours, 12 Minutes, 3 Seconds
>
> or
>
> 23 Days, 13 Hours, 12 Minutes, 3 Seconds
>
> Any examples appreciated, thanks!
--
Jason Morehouse (jm@netconcepts.com)
Netconcepts LTD - Auckland, New Zealand
* Linux: Because rebooting is for adding hardware.