note 83558 added to function.strtotime
| From: | rtwolf at spymac dot com | Date: | Sun, 01 Jun 2008 02:56:45 +0000 |
| Subject: | note 83558 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140037@lists.php.net to get a copy of this message | ||
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).
----
Server IP: 216.235.15.211
Probable Submitter: 65.95.111.35
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/83558
Del: integrated -- https://master.php.net/note/delete/83558/integrated
Del: useless -- https://master.php.net/note/delete/83558/useless
Del: bad code -- https://master.php.net/note/delete/83558/bad+code
Del: spam -- https://master.php.net/note/delete/83558/spam
Del: non-english -- https://master.php.net/note/delete/83558/non-english
Del: in docs -- https://master.php.net/note/delete/83558/in+docs
Del: other reasons-- https://master.php.net/note/delete/83558
Reject -- https://master.php.net/note/reject/83558
Search -- https://master.php.net/manage/user-notes.php