|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-31 19:51 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 10:00:01 2025 UTC |
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