Calculate age in php

0

How you can get age from date of birth in Date format yyyy-mm-dd

while ($fila=$resul1->fetch_assoc()) {

   $tiempo = strtotime($fila['fecha_nac']); 
   $ahora = time(); 
   $edad = ($ahora-$tiempo)/(60*60*24*365.25); 
   $edadFinal = floor($edad); 

  $pdf->Cell(45,6, 'Edad:'.utf8_decode($edadFinal).'') ,0,'J');

}

I print -1 in final age

    
asked by IndiraRivas 12.11.2018 в 20:45
source

0 answers