Hi Guys,
RE: [Updated] Previous and Next Month and Year
Here is part of my code:
$month = 6;
// Current month value, but changes changes with next/prev links.
// Value used by a mini calendar script "phpcalendar"...
// Originally derived via: $month = date('n', time());
// And updated with $month = $month +1 for next month
// And $month = $month -1 for next month
// So the value will be 1 through 12 for current year's months.
// And 0, -1, -2 etc. for last year and 13, 14 etc. for next year.
$prev_month = date('F Y', mktime(0, 0, 0, date("m")-$month, date("d"),
date("Y")));
$next_month = date('F Y', mktime(0, 0, 0, date("m")+$month, date("d"),
date("Y")));
echo "Month: $month <br /> \n";
echo "Prev: $prev_month <br /> \n";
echo "Next: $next_month <br /> \n";
The result:
Month: 6
Prev: December 2006
Next: December 2007
The desired results would be:
Month: 6
Prev: May 2007
Next: July 2007
And needs to bear in mind the year...
The phpcalendar script is working perfectly with my own next
and prev month links using $month +1 and $month -1. So I am
trying to get my Event boxes to work in the same way listing
the previous month, current month and next month.
Thanks,
Keith
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php