Calculate difference between 2 dates

Used DateTime and DateInterval classes to calculate difference between 2 dates. Read more.

php
fork add to bundle source
function diff_dates($input_date_start, $input_date_end) { $dt_start = new DateTime($input_date_start); $dt_end = new DateTime($input_date_end); $interval = $dt_start->diff($dt_end); return $interval; }

usage

load_function('dates_difference'); $interval = diff_dates('2019/10/10', '2019/05/05'); echo $interval->days; # days amount // 158
← how to use this in app?
create log ...inout