Edit report at https://bugs.php.net/bug.php?id=65412&edit=1
ID: 65412 Updated by: ras...@php.net Reported by: laurisnet at inbox dot lv Summary: strtotime('2013-07-31 -1 month') return wrong result -Status: Open +Status: Not a bug Type: Bug Package: Date/time related Operating System: Windows 7 64bit PHP Version: 5.4Git-2013-08-07 (Git) Block user comment: N Private report: N New Comment: This is not a bug. This is standard behaviour for date arithmetic when the target date is impossible. There is an explanation from the GNU tools here: http://www.gnu.org/software/tar/manual/html_chapter/Date-input- formats.html#SEC125 Previous Comments: ------------------------------------------------------------------------ [2013-08-07 09:19:10] laurisnet at inbox dot lv Description: ------------ Function strtotime() return wrong value for 2013-07-31 date with parameters: A) -1 month B) last month Test script: --------------- <? // This returns: 2013-07-01 // But expected was: 2013-06-30 echo date("Y-m-d", strtotime('2013-07-31 -1 month')); ?> Expected result: ---------------- 2013-06-30 Actual result: -------------- 2013-07-01 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65412&edit=1