Re: [PHP] Increase a month
i think strtotime() doesn't understand the $month variable, Since you are adding $month + 1 the function strtotime needs the + and the variable is not passing the + sign .. hope that makes sense .. instead of putting a variable in strtotime try just doing strtotime("+1 month"); and see if it works. Note: strtotime() does the math, thats why it doesn't work, or at least thats what i think is happening. cheers, - Sebastian -Original Message- From: shaun [mailto:[EMAIL PROTECTED] Sent: Thursday, March 20, 2003 4:00 PM To: [EMAIL PROTECTED] Subject: [PHP] Increase a month Hi, could someone tell me why this: "; $month = $month + 1; echo "\$month: ".date(F,strtotime($month)).""; ?> outputs this: $month: March $month: March surely it should be: $month: March $month: April Thanks in advance for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Increase a month
echo date("F"); // prints March echo date("F", strtotime("month + 1")); // prints April - Kevin - Original Message - From: "Boaz Yahav" <[EMAIL PROTECTED]> To: "shaun" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, March 21, 2003 1:44 PM Subject: RE: [PHP] Increase a month > This can help : > > http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=3541 > > Sincerely > > berber > > Visit http://www.weberdev.com/ Today!!! > To see where PHP might take you tomorrow. > > > -Original Message- > From: shaun [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 20, 2003 4:00 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Increase a month > > > Hi, > > could someone tell me why this: > > $month = date(m); >echo "\$month: ".date(F,strtotime($month)).""; >$month = $month + 1; >echo "\$month: ".date(F,strtotime($month)).""; > ?> > > outputs this: > > $month: March > $month: March > > surely it should be: > > $month: March > $month: April > > Thanks in advance for your help. > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Increase a month
This can help : http://www.weberdev.com/index.php3?GoTo=get_example.php3?count=3541 Sincerely berber Visit http://www.weberdev.com/ Today!!! To see where PHP might take you tomorrow. -Original Message- From: shaun [mailto:[EMAIL PROTECTED] Sent: Thursday, March 20, 2003 4:00 PM To: [EMAIL PROTECTED] Subject: [PHP] Increase a month Hi, could someone tell me why this: "; $month = $month + 1; echo "\$month: ".date(F,strtotime($month)).""; ?> outputs this: $month: March $month: March surely it should be: $month: March $month: April Thanks in advance for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Increase a month
For this exact instance (ie, trying to get the current month, and next month) then all you need is: Justin on 21/03/03 1:00 AM, shaun ([EMAIL PROTECTED]) wrote: > Hi, > > could someone tell me why this: > > $month = date(m); > echo "\$month: ".date(F,strtotime($month)).""; > $month = $month + 1; > echo "\$month: ".date(F,strtotime($month)).""; > ?> > > outputs this: > > $month: March > $month: March > > surely it should be: > > $month: March > $month: April > > Thanks in advance for your help. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Increase a month
date() returns a unix timestamp, which is in seconds. You are only adding one second. Try using mktime, and increment hte month argument there. Josh. On March 20, 2003 09:00 am, shaun wrote: > Hi, > > could someone tell me why this: > > $month = date(m); >echo "\$month: ".date(F,strtotime($month)).""; >$month = $month + 1; >echo "\$month: ".date(F,strtotime($month)).""; > ?> > > outputs this: > > $month: March > $month: March > > surely it should be: > > $month: March > $month: April > > Thanks in advance for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Increase a month
Hi, could someone tell me why this: "; $month = $month + 1; echo "\$month: ".date(F,strtotime($month)).""; ?> outputs this: $month: March $month: March surely it should be: $month: March $month: April Thanks in advance for your help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php