|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-05-31 23:17 UTC] tavancini at hotmail dot com
Description:
------------
strtotime not calculating actual date subtraction
Reproduce code:
---------------
<?
echo date( "m/Y", strtotime("-11 month") ) . "<br><br>";
echo date( "m/Y", strtotime("-10 month") ) . "<br><br>";
?>
Expected result:
----------------
07/2003
08/2003
Actual result:
--------------
07/2003
07/2003
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 20:00:01 2025 UTC |
Better demonstration: for($x = 12; $x >= 1; $x--) echo date("m/Y", strtotime(sprintf("$x month%s ago", $x == 1 ? '' : 's'))) . "\n"; Odd assortment of dates.