I need to create next and previous link urls
here’s a sample
<a href="/calendar/2009/10/">previous</a>
<? echo $_GET['month'].', '.$_GET['year']; // shows 11, 2009
<a href="/calendar/2009/12/">next</a>
where the 2nd segment is the year and the first segment is the month
I’ve got the month and the year in the GET array, but any ideas how best to do this?
I was thinking prevmonth = month-1, but then if the previous month was a new year, that would get all messed up.
You can use
mktimewith out-of-range values to do things like this. See the example #2 on the manual page.e.g.
echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997));will give1998-01-01.