Re: RE: Newbie Time Fields question
| From: | Rasmus Lerdorf | Date: | Sun, 14 Jan 2001 07:10:36 +0000 |
| Subject: | Re: RE: Newbie Time Fields question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5847@lists.php.net to get a copy of this message | ||
> 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