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
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: 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-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 21:01:27 2025 UTC