<?php $format = "\M\o\\n\\t\h=n&\a\m\p;\Y\e\a\\r=Y"; //OUTPUT FORMAT $m = date('m'); $y = date('Y'); $dates = array(); for ($i = 1; $i < 13; ++$i) { if ($i == $m + 1) --$y; $dates[] = date($format, mktime(12, 0, 0, $i, 1, $y)); } /* WHEN YOU PARSE THE ARRAY YOULL GET A LISTING OF MONTHS (JAN-DEC) WHERE BY THE CURRENT MONTH BACK TO JAN ARE OF THE CURRENT YEAR AND WHEREBY THE NEXT MONTH TO DEC ARE OF THE PREVIOUS YEAR E.G TODAY: JAN 2010 OUTPUT: Month=1&Year=2010 Month=2&Year=2009 Month=3&Year=2009 Month=4&Year=2009 Month=5&Year=2009 Month=6&Year=2009 Month=7&Year=2009 Month=8&Year=2009 Month=9&Year=2009 Month=10&Year=2009 Month=11&Year=2009 Month=12&Year=2009 E.G TODAY: NOV 2010 OUTPUT: Month=1&Year=2010 Month=2&Year=2010 Month=3&Year=2010 Month=4&Year=2010 Month=5&Year=2010 Month=6&Year=2010 Month=7&Year=2010 Month=8&Year=2010 Month=9&Year=2010 Month=10&Year=2010 Month=11&Year=2010 Month=12&Year=2009 */ ?>
Friday, January 29, 2010
Twelve month historical reference (month/year) (non-rolling)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment