You are here: Re: [PHP] Mktime strange « PHP « IT news, forums, messages
Re: [PHP] Mktime strange

Posted by Robin Vickery on 10/20/75 11:25

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация