Doc #68944 [Opn->Nab]: strftime %G problem with 31-12-2013
| From: | danack@php.net | Date: | Thu, 29 Jan 2015 16:02:00 +0000 |
| Subject: | Doc #68944 [Opn->Nab]: strftime %G problem with 31-12-2013 | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11899@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68944&edit=1
ID: 68944
Updated by: danack@php.net
Reported by: kesavan dot krishnan at krds dot fr
Summary: strftime %G problem with 31-12-2013
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: Scripting Engine problem
Operating System: ubuntu 13.10
PHP Version: 5.4.37
Block user comment: N
Private report: N
New Comment:
Yeah - you almost certainly don't want to use %G http://en.wikipedia.org/wiki/ISO_week_date
"The ISO 8601 definition for week 01 is the week with the year's first Thursday in it.
Hence the earliest possible dates are 29 December through 4 January, the latest 4 through 10
January."
Previous Comments:
------------------------------------------------------------------------
[2015-01-29 14:04:05] gabri dot ns at gmail dot com
please use %Y
%G, %g, %V, and %u is used for ISO8601 weekdays. please see the documentation of %V for more
information. http://php.net/manual/en/function.strftime.php
------------------------------------------------------------------------
[2015-01-29 13:40:30] kesavan dot krishnan at krds dot fr
Description:
------------
---
From manual page: http://www.php.net/faq
---
In php 5.4.35 i user strftime %A %e %B %G to get the date information.But if am passing date
31-12-2011, 31-12-2012, 31-12-2013, 31-12-2014 it return the year number+1.For exmp.if year is 2013
it return 2014.
Test script:
---------------
$mytime = new DateTime('2012-12-31');
echo strftime('%A %e %B %G', $mytime->getTimestamp());
Expected result:
----------------
Monday 31 December 2012
Actual result:
--------------
Monday 31 December 2013
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68944&edit=1