Home Tutorial Php Phpdate PHP Date add 1 month

 
 

Share on Google+Share on Google+
PHP Date add 1 month
Posted on: August 26, 2009 at 12:00 AM
Advertisement
Example How to add one month to a date. You will learn how to addding 1 month to a date in PHP programming language.

PHP Date add 1 month

This example shows you how one month can be added to a PHP Date object. Date manupulation is one of the basic requirement of any business application. Example explained here can be used easily.

Code example to add 1 month:

<?php

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

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

//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)."<br>";

?>

 

The output of the program:
Today: 2009-08-25
After adding one month: Friday 25th of September 2009

 

Advertisement

Related Tags for PHP Date add 1 month:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: August 26, 2009

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com