|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-03-31 04:49 UTC] derick@php.net
[2012-05-31 19:45 UTC] ian_dunn at yahoo dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 07 10:00:01 2025 UTC |
Description: ------------ strtotime("- x month") will not work properly when around a month change. The following code example was run on 31.march. I have seen the previous bug reports that indicate that month is really an alias for 30.5 days. However, this causes problems when you need to correctly iterate (dynamically) with the month keyword. It should iterate correctly when its specified as month, if not my opinion is that implementations should use strtotime("- ".$num*"30.5"." days"); Reproduce code: --------------- for( $c=0;$c<12;$c++ ) echo date("F",strtotime("-".$c." month"))."<br>"; Expected result: ---------------- March February Januar December November October Actual result: -------------- March January December December October October ...