Sunday, 13 January 2013

How to add one day in PHP?

The following code is used many a times in our web development, we always try to add one day in today’s date to get tomorrow’s date. The following code will surely help you doing this.



$todayDate = date("Y-m-d");// current date

echo "Today: ".$todayDate."
";

//Add one day to today
$date = strtotime(date("Y-m-d", strtotime($todayDate)) . " +1 day");
echo "After adding one day: ".date('l dS \o\f F Y', $date)."
";

?>

No comments:

Post a Comment