note 83558 deleted from function.strtotime by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 08:02:03 +0000 |
| Subject: | note 83558 deleted from function.strtotime by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196746@lists.php.net to get a copy of this message | ||
Note Submitter: rtwolf at spymac dot com
----
Someone already reported an issue with finding the next month on the 31st of a month goes to two
months down (essentially the next month with 31 days). There's a workaround for PHP 5.3+ here:
http://bugs.php.net/bug.php?id=44073
If you don't have 5.3 like me (and I can't update it) this code works:
<?php
// On the 31st of May:
strtotime("+1 month"); // Outputs July
strtotime("+1 month", strtotime(date("F") . "1")); // Outputs June
?>
In Engish: Figure out next month relative to the first of this month (date ("F") returns
current month).