note 56376 deleted from function.date by nlopess
| From: | nlopess@php.net | Date: | Thu, 01 Sep 2005 10:43:56 +0000 |
| Subject: | note 56376 deleted from function.date by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-94581@lists.php.net to get a copy of this message | ||
Note Submitter: TD
----
I was having trouble with the following code:
<?php
echo "Next month: " . date("F", strtotime("+1 month"));
?>
For some reason, today (august 31st), this was outputting: "Next month: October".
I can't figure out why, so here's my hack.
<?php
echo "Next month: " . month_to_hr(date("n"));
function month_to_hr($monthnum) {
switch ($monthnum) {
case 1: return "January"; break;
case 2: return "February"; break;
case 3: return "March"; break;
case 4: return "April"; break;
case 5: return "May"; break;
case 6: return "June"; break;
case 7: return "July"; break;
case 8: return "August"; break;
case 9: return "September"; break;
case 10: return "October"; break;
case 11: return "November"; break;
case 12: return "December"; break;
case default: return "Unknown"; break;
}
}
?>