Solved

PHP display current and next month (unless date > 15) in which case show next month and next month +1

Posted on 2014-09-03
4
236 Views
Last Modified: 2014-09-03
Hi

I'm looking to display the current and next month (unless date > 15) in which case show next month and next month +1

e.g. on  3rd Sept months shown to be September and October
...... on 16th Sept months shown to be October and November

points for full code please as I'm nearing a deadline :)
0
Comment
Question by:Neil Thompson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 11

Accepted Solution

by:
Radek Baranowski earned 500 total points
ID: 40301191
if (date("d")<=15)
{
echo date("F",mktime(0,0,0,date("m"),1,2000))." ". date("F",mktime(0,0,0,date("m")+1,1,2000));
}
else
{
echo date("F",mktime(0,0,0,date("m")+1,1,2000))." ". date("F",mktime(0,0,0,date("m")+2,1,2000));
}

Open in new window

0
 
LVL 3

Author Comment

by:Neil Thompson
ID: 40301394
MAny thanks for this but when I also add the year "Y" it comes up with 2000, how can I get it to show the current year as well for each month please?
0
 
LVL 3

Author Closing Comment

by:Neil Thompson
ID: 40301413
just realised I just alter the 2000 to date("Y") to get current year :)
thanks
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 40301418
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question