Design Programming Articles About

This tutorial will aid in simple date manipulations using php.

Tomorrow is 02/07/12
60 days away is 04/06/12
3 months away is 05/06/12
3 years away is 02/06/15


Here is the code needed to display the date changes seen above.

$tomorrow = mktime(0, 0, 0, date("m"), date("d")+1, date("y"));
echo "Tomorrow is ".date("m/d/y", $tomorrow)."<br>";

$sixty = mktime(0, 0, 0, date("m"), date("d")+60, date("y"));
echo "60 days away is ".date("m/d/y", $sixty)."<br>";

$threemonths = mktime(0, 0, 0, date("m")+3, date("d"), date("y"));
echo "3 months away is ".date("m/d/y", $threemonths)."<br>";

$threeyears = mktime(0, 0, 0, date("m"), date("d"), date("y")+3);
echo "3 years away is ".date("m/d/y", $threeyears)."<br>";





User, n. The word computer professionals use when they mean "idiot."
Dave Barry


Recent Additions



The Trimmings


Mrs. Hood's English Resource Center
Contact Us
Personal Links
RSS