php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63190 IntlDateFormatter::format loose a year on 2012 Jan
Submitted: 2012-09-30 09:44 UTC Modified: 2013-06-09 22:16 UTC
Votes:4
Avg. Score:4.0 ± 0.7
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:3 (75.0%)
From: dpmancus at gmail dot com Assigned: cataphract (profile)
Status: Not a bug Package: intl (PECL)
PHP Version: Irrelevant OS: linux
Private report: No CVE-ID: None
 [2012-09-30 09:44 UTC] dpmancus at gmail dot com
Description:
------------
$a= \DateTime::createFromFormat('Y-m-d H:i:s', '2012-01-01 10:56:31');

$formatter = new IntlDateFormatter(
            'it',
            \IntlDateFormatter::FULL,
            \IntlDateFormatter::FULL,
            'Europe/Rome',
            \IntlDateFormatter::GREGORIAN,
            'd-MMMM-Y H:m:s'
        );

echo "\ndate: " . date('d-m-Y H:i:s', $a->getTimestamp()) . "\n";
echo "formatter: " . $formatter->format($a->getTimestamp()) . "\n\n";

Expected result:
----------------
date: 01-01-2012 11:55:38
formatter: 1-gennaio-2012 10:55:38


Actual result:
--------------
date: 01-01-2012 11:55:38
formatter: 1-gennaio-2011 10:55:38


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-30 09:51 UTC] dpmancus at gmail dot com
please do not worry about time, i've copied from terminal the result of the 
attempt with that time(10:55:38)
 [2012-10-04 03:35 UTC] laruence@php.net
-Assigned To: +Assigned To: cataphract
 [2013-06-09 22:16 UTC] cataphract@php.net
-Status: Assigned +Status: Not a bug
 [2013-06-09 22:16 UTC] cataphract@php.net
"Y" means year of "week of year" purposes. You mean "y". See the table on http://icu-project.org/apiref/icu4c/classicu_1_1SimpleDateFormat.html#details
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC