Bug #77502 [Opn->Nab]: strftime gets year wrong
| From: | derick@php.net | Date: | Tue, 22 Jan 2019 19:18:32 +0000 |
| Subject: | Bug #77502 [Opn->Nab]: strftime gets year wrong | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-219138@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77502&edit=1
ID: 77502
Updated by: derick@php.net
Reported by: tomstiller at alumni dot purdue dot edu
Summary: strftime gets year wrong
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Mac OS 10.14.2 (18C54)
PHP Version: 7.3.1
Block user comment: N
Private report: N
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
This is correct behaviour. %G returns the *ISO* 8601 week based year, and not the natural year,
which is %Y. See also: https://derickrethans.nl/iso-8601-weeks.html
Previous Comments:
------------------------------------------------------------------------
[2019-01-22 18:53:12] tomstiller at alumni dot purdue dot edu
Description:
------------
strftime returns the wrong year for the last day of certain years (2014 & 2018 tested.
Test script:
---------------
<?php
echo strftime("%c - %Z", strtotime('12/31/2014')), "\n";
echo strftime("%A, %B %e, %G - %Z", strtotime('12/31/2014')), "\n";
echo strftime("%c - %Z", strtotime('12/31/2018')), "\n";
echo strftime("%A, %B %e, %G - %Z", strtotime('12/31/2018')), "\n";
?>
Expected result:
----------------
Wed Dec 31 00:00:00 2014 - EST
Wednesday, December 31, 2014 - EST
Mon Dec 31 00:00:00 2018 - EST
Monday, December 31, 2018 - EST
Actual result:
--------------
Wed Dec 31 00:00:00 2014 - EST
Wednesday, December 31, 2015 - EST
Mon Dec 31 00:00:00 2018 - EST
Monday, December 31, 2019 - EST
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77502&edit=1