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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or 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

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-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 04:01:30 2024 UTC