|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-31 09:25 UTC] noisex at apollo dot lv
[2007-05-31 09:27 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 05:00:01 2025 UTC |
Description: ------------ On months with 31th day the strtotime function with +/-$foo month calculates wrong. it calculates -30 days not 31 days. Reproduce code: --------------- Simple example (running today 31 May): <?php for($i=1; $i<=12; $i++) { echo date("Y-M",strtotime("-$i months"))."<br>"; } ?> Expected result: ---------------- 2007-Mar 2007-Feb 2007-Jan 2006-Dec 2006-Nov 2006-Oct 2006-Sep 2006-Aug 2006-Jul 2006-Jun 2006-May 2006-Apr Actual result: -------------- 2007-May 2007-Mar 2007-Mar 2007-Jan 2006-Dec 2006-Dec 2006-Oct 2006-Oct 2006-Aug 2006-Jul 2006-Jul 2006-May