add two date using datetime php class -
i need add 30 days 2014-03-06.
i've done below code:-
$due_dt = new datetime("2014-03-06"); $act_dt = $due_dt->add("+30 days");
this code giving below error:-
message: datetime::add() expects parameter 1 dateinterval, string given
any please...
use datetime::modify
$date = new datetime('2014-03-06'); $date->modify('+30 days'); echo $date->format('y-m-d');
Comments
Post a Comment