Re: Seconds to minutes
| From: | Matt | Date: | Wed, 20 Nov 2002 00:48:43 +0000 |
| Subject: | Re: Seconds to minutes | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125170@lists.php.net to get a copy of this message | ||
>From: "Bob Irwin" <bob@staff.pnc.com.au>
> Sent: Tuesday, November 19, 2002 7:27 PM
>Subject: [PHP] Seconds to minutes
> At the moment, I'm using quite a few lines of code to convert seconds to
> minutes and hours. I'm thinking, surely I'm missing something really
> simple! Is there a PHP function that converts seconds to minutes? Or is
it
> a 4 or 5 (and not always that accurate) lines of code?
You can do something like this:
<?php
$seconds = 265;
$time = date('i s',$seconds);
$minSecs = explode(' ',$time);
echo "{$minSecs[0]} minutes and {$minSecs[1]} seconds<br>\n";
?>