php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77600 DateTime ignores timezone of the php.ini
Submitted: 2019-02-11 07:19 UTC Modified: 2019-02-11 12:42 UTC
From: dominik dot zogg at gmail dot com Assigned: cmb (profile)
Status: Not a bug Package: Date/time related
PHP Version: 7.3.2 OS: Ubuntu 14.04
Private report: No CVE-ID: None
 [2019-02-11 07:19 UTC] dominik dot zogg at gmail dot com
Description:
------------
Create a new DateTime instance with a date, for example 2018-12-01 it get created with GMT, even if the php.ini uses Europe/Zurich

Default timezone => Europe/Zurich
date.timezone => Europe/Zurich => Europe/Zurich

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

$dateTime = new DateTime('2018-12-01');
echo $dateTime->format(\DateTime::ISO8601);
// expected: 2018-12-01T00:00:00+0100 with php.ini (Europe/Zurich)
// what happens: 2018-12-01T00:00:00+0000


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-11 07:33 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2019-02-11 07:33 UTC] requinix@php.net
Make sure you're using the latest version, which is currently 7.3.2-3+ubuntu14.04.1+deb.sury.org+1.
 [2019-02-11 08:40 UTC] dominik dot zogg at gmail dot com
requinix@php.net it works, seems that i had 7.3.2-1+ubuntu14.04.1+deb.sury.org+1 or 7.3.2-2+ubuntu14.04.1+deb.sury.org+1 (installed on friday afternoon)

issue can be closed
 [2019-02-11 12:42 UTC] cmb@php.net
-Status: Feedback +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2019-02-11 12:42 UTC] cmb@php.net
So, not a bug on our side.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Apr 13 05:01:24 2021 UTC