Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Answers Viewqa PHP How to Addding One Month with PHP ?

View Questions and Answers by Category


Have Programming Question? Ask it here!

Nadeem Kumar
How to Addding One Month with PHP ?
2 Answer(s)      3 years and 11 months ago
Posted in : PHP


I am very new in this php programming language. Can anybody will guide me how to add 1 month on a specific date on PHP. Please give any example or reference links. Please feel free for any suggestion.


View Answers

February 9, 2011 at 10:23 AM


Are you looking for the syntax of how to fetch ISO Date Format in PHP? By using this DateTime::setISODate() function you will be retrieve the ISO Date from the specific date. For details look below example of the ISO date function in PHP ...


$datetime = new DateTime();

// Offset from start of week 2 (7) = 5
$datetime->setISODate(2009, 2, 5); // Day 5 of week 2 of 2009 is the 9th of January. 

// Offset from start of week 2 (7) = 10
$datetime->setISODate(2009, 2, 10); // Day 10 of week 2 of 2009 is the 14th of January.


February 9, 2011 at 10:33 AM


You asking about how to adding one month in a specific date in PHP. This below example shows you how one month to a Date in PHP Date object.

Examples as below: ...


//PHP Example code to add one moth to a date

$todayDate = date("Y-m-d");// current date echo "Today: ".$todayDate."

//Add one day to today $dateOneMonthAdded = strtotime(date("Y-m-d", strtotime($todayDate)) . "+1 month");

echo "After adding one month: ".date('l dS \o\f F Y', $dateOneMonthAdded)."



Related Tutorials/Questions & Answers: