Sai Gopal Wordpress Blog

saigopal wordpress blog

Saigopal's website

Saigopal's website

My Daughter Website

Weebly

Palwow

Freelance Jobs

Friday, September 17, 2010

PHP Date add 1 month

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 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);






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

No comments: