I am trying to calculate the difference between two dates with format Y-m-d H:i:s
for example 2017-04-10 22:39:09
pair that shows me the difference of days, hours and minutes. One of the dates will be the one in the BDD and the other the current one. What I have at the moment is this:
//Hago la consulta etc... y esta es la variable donde almacenaré la fecha
$fec_ = transcurridoPublicacion($fila['Prod_Fec']);
The function that calculates it:
function transcurridoPublicacion($fecha){
$fecha2 = date("Y-m-d H:i:s");
$fechaF = date_diff($fecha, $fecha2);
return $fechaF;
}
you can calculate it as follows:
You can try something like this:
Anyway , here is the documentation.
And you print it: