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
211 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:NeilT
  • 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:NeilT
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:NeilT
ID: 40301413
just realised I just alter the 2000 to date("Y") to get current year :)
thanks
0
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 40301418
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now