PHP Add One Month, one day or one Year to todays date

Home » Blog » PHP Add One Month, one day or one Year to todays date

This example shows you how to add one day, one month or one year to todays date using PHP Date Functions.
for more information refer PHP.net

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

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

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

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

2 Comments on "PHP Add One Month, one day or one Year to todays date"

  1. Ashley says:

    Came in very handy,

    Thanks

    Reply →

Got something to say? Go for it!

How to remove the http://t.co/XhUQ8T6p link from Login / Register Page: On self hosted wordpress blogs wordpress ... http://t.co/LWDOuEfq - 1 week ago