Re: [PHP] convert seconds to hours, minutes, seconds

2003-06-03 Thread CPT John W. Holmes
> I have a value 178607, which is stored as seconds. I
> like to convert it (178607 Secs) to Hours, Minutes and
> Seconds appropiatly.
> Can anybody help me supplying the code?

If it's stored in MySQL, you can use SEC_TO_TIME()

mysql> select sec_to_time(178607);
+-+
| sec_to_time(178607) |
+-+
| 49:36:47|
+-+
1 row in set (0.00 sec)

mysql> select sec_to_time(178607)+0;
+---+
| sec_to_time(178607)+0 |
+---+
|493647 |
+---+
1 row in set (0.00 sec)

---John Holmes...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] convert seconds to hours, minutes, seconds

2003-06-03 Thread Bas Jobsen
function secondstohours($seconds)
{
/* [EMAIL PROTECTED] */
$sec=$seconds%3600;
return (($seconds-$sec)/3600).':'.($sec/60).':'.($sec%60);
}

echo secondstohours(7500);

Op dinsdag 03 juni 2003 14:38, schreef u:
> Hello everybody,
> I have a value 178607, which is stored as seconds. I
> like to convert it (178607 Secs) to Hours, Minutes and
> Seconds appropiatly.
> Can anybody help me supplying the code?
> Thank You,
> - Chinmoy
>
> __
> Do you Yahoo!?
> Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
> http://calendar.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] convert seconds to hours, minutes, seconds

2003-06-03 Thread Jon Haworth
Hi Chinmoy,

> I have a value 178607, which is stored as seconds. I
> like to convert it (178607 Secs) to Hours, Minutes and
> Seconds appropiatly. Can anybody help me supplying the code?

Try something like this:

";
  echo sec2hms(60). "";
  echo sec2hms(66). "";
  echo sec2hms(3600). "";
  echo sec2hms(3666). "";
  echo sec2hms(178607);

?>

HTH
Jon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] convert seconds to hours, minutes, seconds

2003-06-03 Thread Chinmoy Barua
Hello everybody,
I have a value 178607, which is stored as seconds. I
like to convert it (178607 Secs) to Hours, Minutes and
Seconds appropiatly.
Can anybody help me supplying the code?
Thank You,
- Chinmoy

__
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php