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
234 Views
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
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

LVL 11

Accepted Solution

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));
}
``````
0

LVL 3

Author Comment

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

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

LVL 110

Expert Comment

ID: 40301418
0

## Featured Post

Question has a verified solution.

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

### Suggested Solutions

Build an array called \$myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
###### Suggested Courses
Course of the Month6 days, 15 hours left to enroll

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

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