Re: Re: Previous and Next Month and Year

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux