HyperOsmar
Member
Dear colleagues, I need your help...
I have a Date Element where the user enters the date of birth.
Just below another Calc Element that calculates the age of the user. It works perfectly.
The point is that the form is for registering premature children (neonatal) and I need the age to be informed not in years, but in months or days (if the children have not yet completed one month).
I'm using the following code:
$date= '{cad_telemonitoramento_2fase___datanascimento}';
$date = strtotime($date);
$now = time();
$diff = $now - $date;
$years = floor($diff / 31556926);
return $years;
I have a Date Element where the user enters the date of birth.
Just below another Calc Element that calculates the age of the user. It works perfectly.
The point is that the form is for registering premature children (neonatal) and I need the age to be informed not in years, but in months or days (if the children have not yet completed one month).
I'm using the following code:
$date= '{cad_telemonitoramento_2fase___datanascimento}';
$date = strtotime($date);
$now = time();
$diff = $now - $date;
$years = floor($diff / 31556926);
return $years;