Re: Re: Previous and Next Month and Year
| From: | Myron Turner | Date: | Sun, 17 Jun 2007 17:08:08 +0000 |
| Subject: | Re: Re: Previous and Next Month and Year | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-257220@lists.php.net to get a copy of this message | ||
Keith Spiller wrote:
Hi Vlad, Thank you for taking the time to help me. The code: $prev_month = date('F Y', mktime(0, 0, 0, 0, date('m') - 6, date('Y'))); $next_month = date('F Y', mktime(0, 0, 0, 0, date('m') + 6, date('Y'))); echo "$prev_month <br /> \n"; echo "$next_month <br /> \n"; Generates: November 2006 December 2006 The $prev_month value seems correct, but the $next_month value should be: December 2008 Do you see my mistake? You've mixed up the parameter positions:$prev_month = date('F Y', mktime(0, 0, 0, date("m")-6, date("d"), date("Y"))); $next_month = date('F Y', mktime(0, 0, 0, date("m")+6, date("d"), date("Y"))); See http://ca3.php.net/manual/en/function.date.php for just this example. -- _____________________ Myron Turner http://www.room535.org http://www.bstatzero.org http://www.mturner.org/XML_PullParser/