php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48940 date('Y') generates 0000 while date('y') generates 09
Submitted: 2009-07-16 06:16 UTC Modified: 2010-12-20 12:45 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: trizt at iname dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.2.10 OS: Linux PPC 32bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: trizt at iname dot com
New email:
PHP Version: OS:

 

 [2009-07-16 06:16 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-16 07:07 UTC] 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 08:36 UTC] 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 12:40 UTC] scottmac@php.net
Bug #48276

It's been reported a handful of times now, searching for date and 0000 shows it.
 [2010-12-20 12:45 UTC] jani@php.net
-Package: Tidy +Package: Date/time related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 21:01:33 2024 UTC