I'm having trouble handling the time to lower it in php.
My idea is to get the time that comes from the database and decrease with the current time and bring the rest, but I'm not getting it.
code I am using as an example:
$results =DB::select("SELECT HoraCriacao FROM partidas WHERE (Aceitou=2) ORDER by Id desc LIMIT 1 ");
foreach($results as $row){
$Hroin=$row->HoraCriacao;
}
$Hroin = strtotime($Hroin);
$Hroin=date('H:i:s',$Hroin);
$Hroin=date_create($Hroin);
$Horat= date('H:i:s');
$Horat = explode(":", $Horat);
date_sub($Hroin, date_interval_create_from_date_string($Horat[0].' hours'));
date_sub($Hroin, date_interval_create_from_date_string($Horat[1].' minute'));
date_sub($Hroin, date_interval_create_from_date_string($Horat[2].' second'));
$Hroin=date_format($Hroin, 'H:i:s');
$Hroin = explode(":", $Hroin);
$banco=[
"mod" => "3",
"cron" => "$Hroin[0]:$Hroin[1]:$Hroin[2]"
];
return response()->json($banco);