#35039 [Opn->Bgs]: strftime weird math
ID: 35039
Updated by: derick@php.net
Reported By: arcivanov at mail dot ru
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Slackware 10.1 (kern v2.6.14)
PHP Version: 5.0.5
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Please read the documentation, %G is the ISO year, and if you use it
together with the ISO week modifier (%V) then you'll see that jan 01
falls in the last week of the previous year.
Previous Comments:
------------------------------------------------------------------------
[2005-10-31 19:41:18] arcivanov at mail dot ru
Description:
------------
strftime always displays Jan of year X as Jan of year X-1 when using
'%B, %G' format for some years
Reproduce code:
---------------
function print_time($curr_time)
{
echo ("Time according to date:\t\t" . date("Y-m-d H:i:s",
$curr_time) . "\n");
echo ("Time according to strftime:\t" . strftime('%B, %G',
$curr_time) . "\n");
}
$curr_time = strtotime("2006-01-01 00:00:01");print_time ($curr_time);
$curr_time = strtotime("2005-01-01 00:00:01");print_time ($curr_time);
$curr_time = strtotime("2004-01-01 00:00:01");print_time ($curr_time);
$curr_time = strtotime("2003-01-01 00:00:01");print_time ($curr_time);
$curr_time = strtotime("2002-01-01 00:00:01");print_time ($curr_time);
$curr_time = strtotime("2001-01-01 00:00:01");print_time ($curr_time);
$curr_time = strtotime("2000-01-01 00:00:01");print_time ($curr_time);
$curr_time = strtotime("1999-01-01 00:00:01");print_time ($curr_time);
Expected result:
----------------
Time according to date: 2006-01-01 00:00:01
Time according to strftime: January, 2006
Time according to date: 2005-01-01 00:00:01
Time according to strftime: January, 2005
Time according to date: 2004-01-01 00:00:01
Time according to strftime: January, 2004
Time according to date: 2003-01-01 00:00:01
Time according to strftime: January, 2003
Time according to date: 2002-01-01 00:00:01
Time according to strftime: January, 2002
Time according to date: 2001-01-01 00:00:01
Time according to strftime: January, 2001
Time according to date: 2000-01-01 00:00:01
Time according to strftime: January, 2000
Time according to date: 1999-01-01 00:00:01
Time according to strftime: January, 1999
Actual result:
--------------
Time according to date: 2006-01-01 00:00:01
Time according to strftime: January, 2005
Time according to date: 2005-01-01 00:00:01
Time according to strftime: January, 2004
Time according to date: 2004-01-01 00:00:01
Time according to strftime: January, 2004
Time according to date: 2003-01-01 00:00:01
Time according to strftime: January, 2003
Time according to date: 2002-01-01 00:00:01
Time according to strftime: January, 2002
Time according to date: 2001-01-01 00:00:01
Time according to strftime: January, 2001
Time according to date: 2000-01-01 00:00:01
Time according to strftime: January, 1999
Time according to date: 1999-01-01 00:00:01
Time according to strftime: January, 1998
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=35039&edit=1
Thread (2 messages)