I am trying to calculate numbers of days between 2 dates.
In the table named "livestock_movements", "date_in" is the start date and "date_out" is the end date. I have a field named "days_in" which I would like to show the days between the two dates, but can't get it to work.
I have in the hooks file livestock_movements.php this code:
Code: Select all
function livestock_movements_after_insert($data, $memberInfo, &$args){
$days_in = (strtotime($data['date_out'])- strtotime($data['date_in']))/86400;
return TRUE;
}