php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74717 Years are wrong
Submitted: 2017-06-08 20:45 UTC Modified: 2017-06-09 13:31 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: will at wflewis dot com Assigned: cmb (profile)
Status: Not a bug Package: intl (PECL)
PHP Version: 7.0.20 OS: MacOS / Linux
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.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: will at wflewis dot com
New email:
PHP Version: OS:

 

 [2017-06-08 20:45 UTC] will at wflewis dot com
Description:
------------
IntlDateFormatter incorrectly adds a year to dates. One such date is provided in the test script.

Test script:
---------------
<?php

$timezone = new DateTimeZone('America/Chicago');
$formatter = new \IntlDateFormatter('en_US', null, null, $timezone, null, 'YYYY-MM-dd');
$date = new DateTime('2018-12-31', $timezone);
echo $formatter->format($date);

// expected: 2018-12-31
// actual:   2019-12-31

Expected result:
----------------
2018-12-31

Actual result:
--------------
2019-12-31

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-06-09 06:59 UTC] contact at frank-liepert dot de
Please try "yyyy-MM-dd" instead of "YYYY-MM-dd".

The documentation (http://php.net/manual/en/intldateformatter.create.php) also links to the possible patterns: http://userguide.icu-project.org/formatparse/datetime
 [2017-06-09 13:31 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2017-06-09 13:31 UTC] cmb@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Indeed, Y gives the year of "Week of Year", while y gives the
year.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 07:01:31 2024 UTC