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

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -

ios - Possible to get UIButton sizeThatFits to work? -