Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[solved] Display current and next month with PHP
I’d like to display the current and next month on a page, like this:
March 2014 and April 2014
At the moment, I’m using this:
<txp:php>echo date("F Y");</txp:php> and <txp:php>echo date("F Y", strtotime("+1 month"));</txp:php>
Today, the last day of the month, it’s displaying this:
March 2014 and May 2014
My server is in America/Los Angeles
timezone, and it’s still March. My Textpattern is also set to America/Los Angeles
. I am in Europe/London
and it’s still March here. Is there a better way to achieving what I want, or is this just a flub that happens on the last day of a given month?
Thanks!
Last edited by gaekwad (2014-03-31 10:09:35)
Offline
Re: [solved] Display current and next month with PHP
Hi, Pete,
try strtotime("first day of next month")
.
Offline
Re: [solved] Display current and next month with PHP
That worked – thank you very much, Oleg.
Offline