Re: Mktime strange
| From: | Robin Vickery | Date: | Wed, 31 Aug 2005 11:01:15 +0000 |
| Subject: | Re: Mktime strange | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221639@lists.php.net to get a copy of this message | ||
On 8/31/05, Hal 9001 Consulting <info@hal9001.it> wrote:
> Hello,
>
> I've got a problem with mktime. It's a very strange behaviour, I don't know
> if is a bug:
>
>
> echo date ("M-d-Y", mktime (0,0,0,07,07,2005)); -> Jul-07-2005 (right)
> echo date ("M-d-Y", mktime (0,0,0,08,07,2005)); -> Dec-07-2004 (?????????)
>
> Can anyone help me to solve this question? Is it a bug?
Numbers with leading zeros are octal. 08 is not a valid octal number,
and is interpreted as 0.
The solution is to not use leading zeros...
echo date ("M-d-Y", mktime (0,0,0,8,7,2005)); -> Aug-07-2005
-robin