quot;Jonathan Sharp" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: "'Matt'" <[EMAIL PROTECTED]>; "'Bob Irwin'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, November 20, 2002 12:41 PM
Subject: Re: [PHP] Seconds t
i'll just throw my code in here while we're at it...
$seconds = 3600*5 + (60 * 10) + 45;
$hours = floor( $seconds / 3600 );
$mins = floor( ($seconds % 3600) / 60 );
$seconds = floor( ($seconds % 60) );
echo "Hours: $hours\nMins: $mins\nSeconds: $seconds\n";
-js
John W. Holmes wrote:
>>You can
On Wed, 20 Nov 2002, Bob Irwin wrote:
> Its seems far more reliable than what I am using (dividing by 60 for
> minutes, 3600 for hours and doing rounding, exploding if its not a round
> number etc).
>
> Its only for measuring short times, so Matt's suggestion should work ok.
> Ideally though, beca
'Bob Irwin'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, November 20, 2002 12:09 PM
Subject: RE: [PHP] Seconds to minutes
> > You can do something like this:
> > > $seconds = 265;
> > $time = date('i s',$seconds);
> >
t;; "'Bob Irwin'" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Wednesday, November 20, 2002 12:09 PM
Subject: RE: [PHP] Seconds to minutes
> > You can do something like this:
> > > $seconds = 265;
> > $time = date('i s',$secon
> You can do something like this:
> $seconds = 265;
> $time = date('i s',$seconds);
> $minSecs = explode(' ',$time);
> echo "{$minSecs[0]} minutes and {$minSecs[1]} seconds\n";
> ?>
That doesn't work for anything over 3599 seconds, though...
---John Holmes...
--
PHP General Mailing List
>From: "Bob Irwin" <[EMAIL PROTECTED]>
> 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 somet
Hey Guys,
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?
Any ideas or
8 matches
Mail list logo