Hello,
I'm trying to subtract two different hours using this function:
function update_data($data)
{
date_default_timezone_set('America/Bogota');
$date1 = date("Y-m-d H:i:s");
$date2 = $data["params"]["note"];
//Convert them to timestamps.
$date1Timestamp = strtotime($date1);
$date2Timestamp = strtotime($date2);
//Calculate the difference.
$difference = ($date2Timestamp – $date1Timestamp)/60;
$diferencia= number_format($difference, 0, '.', ' ');
$data["params"]["staff_note"] = $date1;
$data["params"]["total_discount"] = $data["params"]["total"] – $data["params"]["product_discount"];
$data["params"]["sale_status"] = "Completed";
$data["params"]["due_date"] = $diferencia;
$data["params"]["updated_by"] = $data["params"]["reference_no"] – $data["params"]["due_date"];
$data["params"]["updated_at"] = $data["params"]["updated_by"] * 500;
$data["params"]["paid"] = $data["params"]["grand_total"] + $data["params"]["updated_at"];
}
With pure PHP works fine, but in grid there is problem because update cols with this value: -24 807 112 to all grid.
Thanks by your help