### Affected Page URL https://www.php.net/manual/zh/function.date.php ### Describe the bug Today is 2025-12-31, PHP version is 8.2.28 ``` echo date('Y-m', strtotime('-1 month')); // The result is "2025-11" ``` ### Steps to reproduce Today is `2025-12-31`, PHP version is 8.2.28 ``` echo date('Y-m', strtotime('-1 month')); // The result is "2025-11" ``` ### Expected behavior Today is `2025-12-31`, PHP version is 8.2.28 ``` echo date('Y-m', strtotime('-1 month')); // The result is "2025-11" ``` ### Screenshots _No response_ ### Additional context _No response_
Activity
sy-records commentedon Jan 6, 2026
strtotime is not reliable on the 29th, 30th, or 31st of a month.
https://www.laruence.com/2018/07/31/3207.html