Re: Mktime strange

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/31/05, Hal 9001 Consulting <info@xxxxxxxxxx> 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

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux