Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2001011

Re: [PHP-DB] RE: Newbie Time Fields question From: Rasmus Lerdorf (rasmus <email protected>)
Date: 01/14/01

> A song of 6 minutes and 24 seconds:
>
> mktime(0,6,24) = 384 seconds

Whoa.. 6*60+24 makes more sense here. Your mktime() won't work at all as
it fills in the current time/date for any missing values.

> date("m:i", 384) = 6:24

This also won't work because 'm' stands for month. And it is a bad habit
to get into using mktime() and date() for stuff like this as local
timezones are really going to mess with you.

To convert 384 into 6:24 you can do:

echo (int)(384/60).':'.(384%60);

-Rasmus

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>