Edit report at https://bugs.php.net/bug.php?id=62980&edit=1
ID: 62980 Updated by: ahar...@php.net Reported by: mailzsm at 126 dot com Summary: strtotime bug -Status: Open +Status: Not a bug -Type: Documentation Problem +Type: Bug -Package: CGI/CLI related +Package: Date/time related Operating System: linux redhat4.5 PHP Version: 5.3.16 Block user comment: N Private report: N New Comment: You're asking strtotime() to subtract months, and August has 31 days. So: -1 month = July 31. -2 months = June 31. June only has 30 days, though, so it becomes July 1. -3 months = May 31. And so on. Previous Comments: ------------------------------------------------------------------------ [2012-08-31 08:19:01] mailzsm at 126 dot com Description: ------------ --- intro today is 2012-08-31 echo date("Y-m-d",strtotime("- 1 months")); =====>2012-07-31 echo date("Y-m-d",strtotime("- 2 months")); =====>2012-07-01 (why) echo date("Y-m-d",strtotime("- 3 months")); =====>2012-05-31 >From manual page: http://www.php.net/function.strtotime#refsect1- function.strtotime-description --- ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62980&edit=1