Share
ShareSidebar
2011-12-01 22:58:26 +0

how to sum days to date() in php ?

how to sum days to date() in php ?

$tomorrow = time();

Rate this post

You must be registered to vote first

Comments

jzentt
jzentt 2011-12-01 23:07:24

easy

$days = 1;
$tomorrow
= time() + ( $days * 24 * 60 * 60);
$tomorrow
= date('Y-m-d H:i:s', $tomorrow);

echo
"Tomorrow: ".$tomorrow;
+0
fritz08
fritz08 2011-12-01 23:27:15
$date = date("Y-m-d");// current date

echo date
("Y-m-d", strtotime($date . " +1 day"))." ";

echo date
("Y-m-d", strtotime($date . " +1 week"))." ";

echo date
("Y-m-d", strtotime($date . " +2 week"))." ";

echo date
("Y-m-d", strtotime($date) . " +1 month")." ";
+0
fourteam
fourteam 2011-12-27 08:21:06

Unlike the function date(), it supports dates outside the 1901 to 2038 range. if more 2038, date error,,

use this http://phplens.com/phpeverywhere/adodbdatelibrary

+0

Comment