datetime - Get Date difference and add to new date php -
i have 2 dates , want difference.i can strtotime this
$ts1 = strtotime($date1); $ts2 = strtotime($date2); $seconds_diff = $ts2 - $ts1;
i want add result today date.like if result 1 year , 20 days .my new date next year , 20 days.how can add result new date.thanks issue not difference how add new date.
you must use date_diff , date_add function: $result = date_add(new datetime(), date_diff($ts2-$ts1))
Comments
Post a Comment