Blair Benjamin
asked on
Code to display "next" year dynamically in PHP
Hello,
I'm converting a script from Coldfusion to PHP. One of the lines of code dynamically returns "next" year.
In Coldfusion, the code is #DateFormat(DateAdd('YYYY' ,1,now()), "YYYY")#
What is the PHP equivalent? So at the time of this writing, it would return "2016".
Thanks in advance.
I'm converting a script from Coldfusion to PHP. One of the lines of code dynamically returns "next" year.
In Coldfusion, the code is #DateFormat(DateAdd('YYYY'
What is the PHP equivalent? So at the time of this writing, it would return "2016".
Thanks in advance.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Radek is correct, but I was trying to teach you how to fish. :) Please read through that article - it will give you a lot more insight into what you can do with date/time in PHP than just next year. If you're converting an application, it's pretty vital information.
upvoting what gonzo said. :)
ASKER
Thank you both. This was very helpful. I do know how to fish, but sometimes circumstances just necessitate a quick answer. I had actually done some "fishing" yesterday, but was over complicating it a bit apparently by trying to use the mktime() function in conjunction with the date() function. I appreciate the simplicity that you offered and I do in fact appreciate the link and will read it in its entirety as it's ultimately my desire to grow in my knowledge and understanding. Sometimes time is of the essence thought. :-)