php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73712 DateTime::format returns wrong result
Submitted: 2016-12-10 18:42 UTC Modified: 2016-12-11 00:28 UTC
From: navkal at hotmail dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 7.0.14 OS: Ubuntu 16.04, Windows 10
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: navkal at hotmail dot com
New email:
PHP Version: OS:

 

 [2016-12-10 18:42 UTC] navkal at hotmail dot com
Description:
------------
Used DateTime::format to format the following input:
3/11/2012 2:00

Expected result:
03/11/2012 02:00

Actual result:
03/11/2012 03:00

Observed in the following environments:
- Windows 10: XAMPP, PHP 7.0.9
- Ubuntu: PHP Version 7.0.8-0ubuntu0.16.04.2


Test script:
---------------
$input = "3/11/2012 2:00";
$dt = new DateTime( $input );
$output = $dt->format( "m/d/Y H:i" );
echo( "$input => $output <br/>" );


Expected result:
----------------
03/11/2012 02:00


Actual result:
--------------
03/11/2012 03:00


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-10 19:12 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2016-12-10 19:12 UTC] cmb@php.net
Confirmed for some timezones: <https://3v4l.org/Ntilo>.
 [2016-12-11 00:28 UTC] requinix@php.net
-Status: Verified +Status: Not a bug
 [2016-12-11 00:28 UTC] requinix@php.net
Daylight savings. In the US the 2012 spring DST transition was Mar 11th at 2am.
 [2016-12-11 02:18 UTC] navkal at hotmail dot com
Fascinating.  Thanks for your explanation!
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 10:00:01 2026 UTC