From:             arcivanov at mail dot ru
Operating system: Slackware 10.1 (kern v2.6.14)
PHP version:      5.0.5
PHP Bug Type:     Date/time related
Bug description:  strftime weird math

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 bug report at http://bugs.php.net/?id=35039&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=35039&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=35039&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=35039&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=35039&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=35039&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=35039&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=35039&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=35039&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=35039&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=35039&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=35039&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=35039&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=35039&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=35039&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=35039&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=35039&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=35039&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=35039&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=35039&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=35039&r=mysqlcfg

Reply via email to