php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58115 datefmt fails
Submitted: 2008-03-25 05:08 UTC Modified: 2008-04-03 16:12 UTC
From: Tex at yahoo-inc dot com Assigned:
Status: Closed Package: intl (PECL)
PHP Version: 5.2.1 OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: Tex at yahoo-inc dot com
New email:
PHP Version: OS:

 

 [2008-03-25 05:08 UTC] Tex at yahoo-inc dot com
Description:
------------
Date_format test fails.


As you can see, date is wrong. Also, the test data is strange - how comes tm_mon is 12 (December? January next year?) but tm_yday is 92?


Reproduce code:
---------------
Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '19' , tm_mday : '3' , tm_mon : '3' , tm_year : '105' , tm_wday : '0' , tm_yday
: '92' , tm_isdst : '1' ,
------------

DateFormatter locale= en_US ,datetype = 0 ,timetype =0 Formatted localtime_array is : Saturday, April 2, 2005 7:03:24 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 Formatted localtime_array is : April 2, 2005 7:03:24 PM PST DateFormatter locale= en_US ,datetype = 2 ,timetype =2 Formatted localtime_array is : Apr 2, 2005 7:03:24 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 4/2/05 7:03 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 Formatted localtime_array is : 20050402 07:03 PM

------------
Input localtime is : tm_sec : '24' , tm_min : '3' , tm_hour : '3' , tm_mday : '3' , tm_mon : '3' , tm_year : '205' , tm_wday : '0' , tm_yday
: '92' , tm_isdst : '1' ,
------------

DateFormatter locale= en_US ,datetype = 0 ,timetype =0 Formatted localtime_array is : Thursday, April 2, 2105 3:03:24 AM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 Formatted localtime_array is : April 2, 2105 3:03:24 AM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 Formatted localtime_array is : Apr 2, 2105 3:03:24 AM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 4/2/05 3:03 AM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 Formatted localtime_array is : 21050402 03:03 AM
------------
Input localtime is : tm_sec : '0' , tm_min : '0' , tm_hour : '5' , tm_mday : '12' , tm_mon : '12' , tm_year : '205' , tm_wday : '0' , tm_yday : '92' , tm_isdst : '1' ,
------------

DateFormatter locale= en_US ,datetype = 0 ,timetype =0 Formatted localtime_array is : Thursday, April 2, 2105 5:00:00 AM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 Formatted localtime_array is : April 2, 2105 5:00:00 AM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 Formatted localtime_array is : Apr 2, 2105 5:00:00 AM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 4/2/05 5:00 AM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 Formatted localtime_array is : 21050402 05:00 AM
------------

Input localtime is : tm_sec : '0' , tm_min : '0' , tm_hour : '21' , tm_mday : '12' , tm_mon : '12' , tm_year : '205' , tm_wday : '0' , tm_yday : '92' , tm_isdst : '1' ,
------------

DateFormatter locale= en_US ,datetype = 0 ,timetype =0 Formatted localtime_array is : Thursday, April 2, 2105 9:00:00 PM PT DateFormatter locale= en_US ,datetype = 1 ,timetype =1 Formatted localtime_array is : April 2, 2105 9:00:00 PM PDT DateFormatter locale= en_US ,datetype = 2 ,timetype =2 Formatted localtime_array is : Apr 2, 2105 9:00:00 PM DateFormatter locale= en_US ,datetype = 3 ,timetype =3 Formatted localtime_array is : 4/2/05 9:00 PM DateFormatter locale= en_US ,datetype = -1 ,timetype =-1 Formatted localtime_array is : 21050402 09:00 PM



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-04-03 16:12 UTC] kirtig at yahoo-inc dot com
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

I have fixed this and committed to CVS. 

Note - tm_mon in PHP localtime() are from 0 (Jan) to 11 (Dec) and days of the week are from 0 (Sun) to 6 (Sat).
http://www.php.net/manual/en/function.localtime.php

Whereas in ICU , months are from 1 (Jan) to 12 (Dec) and days of the week are from 1 (Sun) to 7 (Sat).
http://www.icu-project.org/apiref/icu4c/ucal_8h.html
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC