CINXE.COM

PHP :: Bug #74671 :: DST timezone abbreviation has incorrect offset

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel='alternate' type='application/rss+xml' title='Date/time related Bug #74671 - RDF' href='rss/bug.php?id=74671'> <link rel='alternate' type='application/rss+xml' title='Date/time related Bug #74671 - RSS 2.0' href='rss/bug.php?id=74671&format=rss2'> <base href="https://bugs.php.net/"> <title>PHP :: Bug #74671 :: DST timezone abbreviation has incorrect offset</title> <link rel="shortcut icon" href="https://bugs.php.net/images/favicon.ico"> <link rel="stylesheet" href="https://bugs.php.net/css/style.css"> </head> <body> <table id="top" class="head" cellspacing="0" cellpadding="0"> <tr> <td class="head-logo"> <a href="/"><img src="images/logo.png" alt="Bugs" vspace="2" hspace="2"></a> </td> <td class="head-menu"> <a href="https://php.net/">php.net</a>&nbsp;|&nbsp; <a href="https://php.net/support.php">support</a>&nbsp;|&nbsp; <a href="https://php.net/docs.php">documentation</a>&nbsp;|&nbsp; <a href="report.php">report a bug</a>&nbsp;|&nbsp; <a href="search.php">advanced search</a>&nbsp;|&nbsp; <a href="search-howto.php">search howto</a>&nbsp;|&nbsp; <a href="stats.php">statistics</a>&nbsp;|&nbsp; <a href="random">random bug</a>&nbsp;|&nbsp; <a href="login.php">login</a> </td> </tr> <tr> <td class="head-search" colspan="2"> <form method="get" action="search.php"> <p class="head-search"> <input type="hidden" name="cmd" value="display"> <small>go to bug id or search bugs for</small> <input class="small" type="text" name="search_for" value="" size="30"> <input type="image" src="images/small_submit_white.gif" alt="search" style="vertical-align: middle;"> </p> </form> </td> </tr> </table> <table class="middle" cellspacing="0" cellpadding="0"> <tr> <td class="content"> <div id="bugheader"> <table id="details"> <tr id="title"> <th class="details" id="number"><a href="bug.php?id=74671">Bug</a>&nbsp;#74671</th> <td id="summary" colspan="5">DST timezone abbreviation has incorrect offset</td> </tr> <tr id="submission"> <th class="details">Submitted:</th> <td style="white-space: nowrap;">2017-05-29 14:17 UTC</td> <th class="details">Modified:</th> <td style="white-space: nowrap;">2022-05-20 14:31 UTC</td> <td rowspan="6"> <table id="votes"> <tr><th class="details">Votes:</th><td>5</td></tr> <tr><th class="details">Avg. Score:</th><td>3.4 &plusmn; 1.0</td></tr> <tr><th class="details">Reproduced:</th><td>5 of 5 (100.0%)</td></tr> <tr><th class="details">Same Version:</th><td>2 (40.0%)</td></tr> <tr><th class="details">Same OS:</th><td>4 (80.0%)</td></tr> </table> </td> </tr> <tr id="submitter"> <th class="details">From:</th> <td>ewgenij &#x64;&#111;&#x74; starostin &#x61;&#116; fondsnet &#x64;&#111;&#x74; de</td> <th class="details">Assigned:</th> <td><a href="search.php?cmd=display&amp;assign=derick">derick</a> (<a href="https://people.php.net/derick">profile</a>)</td> </tr> <tr id="categorization"> <th class="details">Status:</th> <td>Closed</td> <th class="details">Package:</th> <td><a href="search.php?cmd=display&amp;package_name[]=Date%2Ftime+related">Date/time related</a></td> </tr> <tr id="situation"> <th class="details">PHP Version:</th> <td>7.1.5</td> <th class="details">OS:</th> <td>Linux</td> </tr> <tr id="private"> <th class="details">Private report:</th> <td>No</td> <th class="details">CVE-ID:</th> <td><em>None</em></td> </tr> </table> </div> <div class="controls"> <span id='control_0' class='control active'>View</span> <span id='control_1' class='control'><a href='bug.php?id=74671&amp;edit=1'>Developer</a></span> <span id='control_2' class='control'><a href='bug.php?id=74671&amp;edit=2'>Edit</a></span> </div> <div class="clear"></div> <div class='comment type_comment' ><a name="1496067446">&nbsp;</a><strong>[2017-05-29 14:17 UTC] ewgenij &#x64;&#111;&#x74; starostin &#x61;&#116; fondsnet &#x64;&#111;&#x74; de</strong> <pre class='note'>Description: ------------ When using a timezone abbreviation (e. g. CEST) instead of a geographical timezone name (e. g. Europe/Berlin) in the DateTimeZone constructor, the resulting time offset is that of the corresponding non-DST timezone, coming up an hour short. <a href="https://3v4l.org/VTI3C" rel="nofollow">https://3v4l.org/VTI3C</a> Test script: --------------- $dt = new DateTime( &#039;2017-05-16T10:11:32&#039;, new DateTimeZone(&#039;CEST&#039;) ); var_dump($dt); var_dump($dt-&gt;format(&#039;c&#039;)); Expected result: ---------------- object(DateTime)#1 (3) { [&quot;date&quot;]=&gt; string(26) &quot;2017-05-16 10:11:32.000000&quot; [&quot;timezone_type&quot;]=&gt; int(2) [&quot;timezone&quot;]=&gt; string(4) &quot;CEST&quot; } string(25) &quot;2017-05-16T10:11:32+02:00&quot; Actual result: -------------- object(DateTime)#1 (3) { [&quot;date&quot;]=&gt; string(26) &quot;2017-05-16 10:11:32.000000&quot; [&quot;timezone_type&quot;]=&gt; int(2) [&quot;timezone&quot;]=&gt; string(4) &quot;CEST&quot; } string(25) &quot;2017-05-16T10:11:32+01:00&quot; </pre> </div><h2>Patches</h2> <h2>Pull Requests</h2> <h2 style="border-bottom:2px solid #666;margin-bottom:0;padding:5px 0;">History</h2><div id='comment_filter' class='controls comments'><span id='type_all' class='control active' onclick='do_comment(this);'>All</span><span id='type_comment' class='control ' onclick='do_comment(this);'>Comments</span><span id='type_log' class='control ' onclick='do_comment(this);'>Changes</span><span id='type_svn' class='control ' onclick='do_comment(this);'>Git/SVN commits</span><span id='type_related' class='control ' onclick='do_comment(this);'>Related reports</span> </div> <div id='comments_view' style='clear:both;'> <div class='comment type_log' ><a name="1496135656">&nbsp;</a><strong>[2017-05-30 09:14 UTC] <a href="//people.php.net/cmb">cmb@php.net</a></strong> <div class='log_note'><div class="changeset"> <span class="removed">-Status: Open</span> <span class="added">+Status: Not a bug</span> <span class="removed">-Assigned To:</span> <span class="added">+Assigned To: cmb</span> </div></div></div><div class='comment type_comment' ><a name="1496135656">&nbsp;</a><strong>[2017-05-30 09:14 UTC] <a href="//people.php.net/cmb">cmb@php.net</a></strong> <pre class='note'>Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at <a href="http://www.php.net/manual/" rel="nofollow">http://www.php.net/manual/</a> and the instructions on how to report a bug at <a href="http://bugs.php.net/how-to-report.php" rel="nofollow">http://bugs.php.net/how-to-report.php</a> From the docs[1]: | The behavior of timezones not listed here is undefined. [1] &lt;<a href="http://php.net/manual/en/timezones.php" rel="nofollow">http://php.net/manual/en/timezones.php</a>&gt; </pre> </div><div class='comment type_log' ><a name="1496139174">&nbsp;</a><strong>[2017-05-30 10:12 UTC] <a href="//people.php.net/derick">derick@php.net</a></strong> <div class='log_note'><div class="changeset"> <span class="removed">-Status: Not a bug</span> <span class="added">+Status: Assigned</span> </div></div></div><div class='comment type_comment' ><a name="1496139175">&nbsp;</a><strong>[2017-05-30 10:12 UTC] <a href="//people.php.net/derick">derick@php.net</a></strong> <pre class='note'>No, this is a bug. This should work properly. Although it should *not* adjust for DST changeovers. </pre> </div><div class='comment type_log' ><a name="1496341917">&nbsp;</a><strong>[2017-06-01 18:31 UTC] <a href="//people.php.net/cmb">cmb@php.net</a></strong> <div class='log_note'><div class="changeset"> <span class="removed">-Assigned To: cmb</span> <span class="added">+Assigned To:</span> </div></div></div><div class='comment type_log' ><a name="1653057085">&nbsp;</a><strong>[2022-05-20 14:31 UTC] <a href="//people.php.net/derick">derick@php.net</a></strong> <div class='log_note'><div class="changeset"> <span class="removed">-Status: Open</span> <span class="added">+Status: Assigned</span> <span class="removed">-Assigned To:</span> <span class="added">+Assigned To: derick</span> </div></div></div><div class='comment type_comment' ><a name="1653057085">&nbsp;</a><strong>[2022-05-20 14:31 UTC] <a href="//people.php.net/derick">derick@php.net</a></strong> <pre class='note'><a href="https://github.com/php/php-src/pull/8595/files" rel="nofollow">https://github.com/php/php-src/pull/8595/files</a> </pre> </div><div class='comment type_svn' ><a name="1653658158">&nbsp;</a><strong>[2022-05-27 13:29 UTC] <a href="//people.php.net/git">git@php.net</a></strong> <pre class='note'>Automatic comment on behalf of derickr Revision: <a href="https://github.com/php/php-src/commit/6418eba1cd376b82e94a905bf10212126337bcd2" rel="nofollow">https://github.com/php/php-src/commit/6418eba1cd376b82e94a905bf10212126337bcd2</a> Log: Fixed <a href='bug.php?id=74671'>bug #74671</a> (DST timezone abbreviation has incorrect offset) </pre> </div><div class='comment type_log' ><a name="1653658158">&nbsp;</a><strong>[2022-05-27 13:29 UTC] <a href="//people.php.net/git">git@php.net</a></strong> <div class='log_note'><div class="changeset"> <span class="removed">-Status: Assigned</span> <span class="added">+Status: Closed</span> </div></div></div></div> </td> </tr> </table> <script src='js/util.js'></script> <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script> <script src="js/jquery.cookie.js"></script> <script> function do_comment(nd) { $('#comment_filter > .control.active').removeClass("active"); $(nd).addClass("active"); $.cookie('history_tab', nd.id, { expires: 365 }); if (nd.id == 'type_all') { $('#comments_view > .comment:hidden').show('slow'); } else { $('#comments_view > .comment').each(function(i) { if ($(this).hasClass(nd.id)) { $(this).show('slow'); } else { $(this).hide('slow'); } }); } return false; } </script> <table class="foot" cellspacing="0" cellpadding="0"> <tr> <td class="foot-bar" colspan="2">&nbsp;</td> </tr> <tr> <td class="foot-copy"> <small> <a href="https://php.net/"><img src="images/logo-small.gif" align="left" valign="middle" hspace="3" alt="PHP"></a> <a href="https://php.net/copyright.php">Copyright &copy; 2001-2025 The PHP Group</a><br> All rights reserved. </small> </td> <td class="foot-source"> <small>Last updated: Sat Feb 22 10:01:29 2025 UTC</small> </td> </tr> </table> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10