php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71855 setTimezone() doesn't work sometimes
Submitted: 2016-03-18 17:58 UTC Modified: 2016-03-18 18:04 UTC
From: youwishspambot at example dot orgy Assigned:
Status: Duplicate Package: Date/time related
PHP Version: 7.0.4 OS:
Private report: No CVE-ID: None
 [2016-03-18 17:58 UTC] youwishspambot at example dot orgy
Description:
------------
https://3v4l.org/7CmJA

please fix. ktnxbai :P

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

date_default_timezone_set('UTC');

$date = new DateTime('2015-01-01T12:00:00-05:00');
$timezone = $date->getTimezone();
echo $date->format('H:i'); // 12:00
echo "\n";

$date->setTimezone(new DateTimeZone('UTC'));
echo $date->format('H:i'); // 17:00
echo "\n";

$date->setTimezone($timezone);
echo $date->format('H:i'); // 12:00
echo "\n";

$date->setTimezone(new DateTimeZone('UTC'));
echo $date->format('H:i'); // 12:00 ???
echo "\n";


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-03-18 18:04 UTC] requinix@php.net
-Status: Open +Status: Duplicate
 [2016-03-18 18:04 UTC] requinix@php.net
Duplicate of bug #69916.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Nov 12 18:01:32 2019 UTC