|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-09 12:33 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 25 04:00:02 2025 UTC |
Description: ------------ Calling strtotime("-1 month",$date) when $date = march 30th returns March 1st instead of february 30th (which actually doesn't exist in 2004), I would assume this means it should return February 29th or something close. Reproduce code: --------------- <?php $date = date("2004-03-30"); $previousMonth = date("Y-m-d",strtotime("-1 month",strtotime($date))); echo $previousMonth; ?> Expected result: ---------------- 2004-02-?? ?? could be anything between 01 and 29. Actual result: -------------- 2004-03-01