Always assume people will attempt the most inane things...
--
phill
""Stephan Ahonen"" <[EMAIL PROTECTED]> wrote in message
9969kn$eho$[EMAIL PROTECTED]">news:9969kn$eho$[EMAIL PROTECTED]...
> > Oh in addition this won't work accurately if $time is greater than about
2
> > billion(2147483648 I be
> Oh in addition this won't work accurately if $time is greater than about 2
> billion(2147483648 I believe).
This shouldn't be a problem unless you're calculating how many hours and
minutes a really old guy (>68) has been alive or something.
Sig for a Day
Stephan Ahonen, ICQ 491101
"That's very
I thought about that when I first started, but then went looking to see if
using "\" would return the value without the decimal part. Not good when
you start confusing VB and PHP and it makes you mess up your code.
--
phill
> This way you don't risk rounding up on your first cast to int and bein
Oh in addition this won't work accurately if $time is greater than about 2
billion(2147483648 I believe).
--
phill
""Phillip Bow"" <[EMAIL PROTECTED]> wrote in message
9961qg$ma4$[EMAIL PROTECTED]">news:9961qg$ma4$[EMAIL PROTECTED]...
> function philtime($time){
> $hours = (int) ($time / 3600
k, however, for minutes since that is your most
granular interval.
-jm
-Original Message-
From: Phillip Bow [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 19, 2001 2:43 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Script to convert # of seconds to HH:mm
function philtime($time){
$hours
function philtime($time){
$hours = (int) ($time / 3600);
$min = (int) (($time % 3600) / 60 );
return ("$hours:$min");
}
Should be 3600 since:
60sec = 1min
60min = 1hour
60 * 60 = 3600sec/hour
--
phill
> How about something like this:
>
> $secs = number of seconds;
> $hours = intval
How about something like this:
$secs = number of seconds;
$hours = intval($secs/360);
$minutes = intval(($secs-$hours*360)/60)
$seconds = $secs - $hours*360 - $minutes * 60;
Hope this helps.
Michael Ridinger
On Mon, 19 Mar 2001, Yoshi Melrose wrote:
> Can someone direct me or send me a scrip
7 matches
Mail list logo