Help with date function
Date: 06/23/05
(PHP Community) Keywords: no keywords
OK, I know I have the months right, but I am unssure about the year. Will this work when the next or last month is in a different year?
$NextMonth = date("m", mktime(0, 0, 0, $Month+1, 1, $Year));
$NextYear = date("Y", mktime(0, 0, 0, $Month+1, 1, $Year));
$LastMonth = date("m", mktime(0, 0, 0, $Month-1, 1, $Year));
$LastYear = date("Y", mktime(0, 0, 0, $Month-1, 1, $Year));
Source: http://www.livejournal.com/community/php/311468.html