php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71689 IntlDateFormatter uses system timezone instead of default
Submitted: 2016-02-29 13:56 UTC Modified: 2021-11-11 11:17 UTC
From: dcrystal dot source at gmail dot com Assigned:
Status: Open Package: I18N and L10N related
PHP Version: Irrelevant OS: Linux
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: dcrystal dot source at gmail dot com
New email:
PHP Version: OS:

 

 [2016-02-29 13:56 UTC] dcrystal dot source at gmail dot com
Description:
------------
As per documentation (http://php.net/manual/en/intldateformatter.create.php), the default timezone (and the one used if NULL is given) is the one returned by date_default_timezone_get(). 

This is not the case however with IntlDateFormatter and PHP 5.4/5.3 - which seems to use system timezone instead of date_default_timezone_get().

PHP Version: PHP 5.4.16 / PHP 5.3.3
System timezone: GMT

Even though 5.3 and 5.4 are EOL - they are still widely used. Could this be at least explicitly stated in documentation (changelog section probably) ?

Test script:
---------------
date_default_timezone_set("America/New_York");
$dateFormatter = new IntlDateFormatter('en_US', IntlDateFormatter::NONE, IntlDateFormatter::NONE);
$dateFormatter->setPattern('MM/dd/yy');
$parsed = $dateFormatter->parse("02/29/16");

var_dump(date("Y-m-d H:i:s", $parsed));


Expected result:
----------------
"2016-02-29 00:00:00"

Actual result:
--------------
"2016-02-28 19:00:00"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-11 11:17 UTC] nikic@php.net
-Package: intl +Package: I18N and L10N related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC