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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: youwishspambot at example dot orgy
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC