Sai Gopal Wordpress Blog

saigopal wordpress blog

Saigopal's website

Saigopal's website

My Daughter Website

Weebly

Palwow

Freelance Jobs

Wednesday, February 16, 2011

date functions in php

//PHP Example code to add one day,one month or one year to todays date $todayDate = date("Y-m-d");// current date echo "Today: ".$todayDate."
"; //Add one day to today $dateOneDayAdded = strtotime(date("Y-m-d", strtotime($todayDate)) . "+1 day"); echo "After adding one Day: ".date('l dS \o\f F Y', $dateOneDayAdded)."
"; //Add one month 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)."
"; //Add one Year to today $dateOneYearAdded = strtotime(date("Y-m-d", strtotime($todayDate)) . "+1 year"); echo "After adding one Year: ".date('l dS \o\f F Y', $dateOneYearAdded)."
"; ?>

No comments: