#48940 [Bgs]: date('Y') generates 0000 while date('y') generates 09
| From: | scottmac@php.net | Date: | Thu, 16 Jul 2009 12:40:16 +0000 |
| Subject: | #48940 [Bgs]: date('Y') generates 0000 while date('y') generates 09 | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-139804@lists.php.net to get a copy of this message | ||
ID: 48940
Updated by: scottmac@php.net
Reported By: trizt at iname dot com
Status: Bogus
Bug Type: Date/time related
Operating System: Linux PPC 32bit
PHP Version: 5.2.10
New Comment:
Bug #48276
It's been reported a handful of times now, searching for date and 0000
shows it.
Previous Comments:
------------------------------------------------------------------------
[2009-07-16 08:36:50] trizt at iname dot com
Didn't find any results on similar bugs when I made the search before
writing this one.
Had been nice if you could have made this a duplicate of original bug,
or at least give the bug id.
------------------------------------------------------------------------
[2009-07-16 07:07:58] scottmac@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.
Thank you for your interest in PHP.
Fixed in CVS already, you can use a CVS copy or wait until 5.2.11 is
out or use 5.3.0 which has it fixed.
------------------------------------------------------------------------
[2009-07-16 06:16:05] trizt at iname dot com
Description:
------------
On Linux PPC 32bit (Gentoo with following options: apache2 bcmath
berkdb bzip2 cjk cli crypt ctype curl curlwrappers exif ftp gd gdbm
iconv imap json ldap mhash mysql mysqli ncurses nls pcntl pcre posix
readline reflection session simplexml snmp soap sockets spl ssl suhosin
tidy tokenizer truetype unicode wddx xml xmlreader xmlrpc xmlwriter xpm
xsl yaz zip zlib), the date('Y') don't generate the current year, but
0000.
A simple but not that nice work around is to make
'20'.date('y')
Using the date('Y') works on my x86_64, so I think the bug may be in
just big endian machines (haven't tested this on my sparc yet).
Reproduce code:
---------------
<?php
echo date('Y');
?>
Expected result:
----------------
2009
Actual result:
--------------
0000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48940&edit=1