Apr 7th, 2014, 4:48 AM
Hi guys,
First, i want to thank you for all form tools developer.
This software is really help full.
and for my question,
i want to calculate age from the date submission id, then put it in the display export page.
after reading this forum, i know the Submission Pre-Parser module is the key and i install it then.
and i search the php function to do it.
but i don't know how to put it in Edit Rule page.
the goal is to be two row like ;
Birthdate : dd/mm/yyyy
Age : (this one will be automatically calculated by Pre-Parser module)
thanks in advance
First, i want to thank you for all form tools developer.
This software is really help full.
and for my question,
i want to calculate age from the date submission id, then put it in the display export page.
after reading this forum, i know the Submission Pre-Parser module is the key and i install it then.
and i search the php function to do it.
Code:
<?php
//date in mm/dd/yyyy format; or it can be in other formats as well
$birthDate = "12/17/1989";
//explode the date to get month, day and year
$birthDate = explode("/", $birthDate);
//get age from date or birthdate
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md")
? ((date("Y") - $birthDate[2]) - 1)
: (date("Y") - $birthDate[2]));
echo "Age is:" . $age;
?>
the goal is to be two row like ;
Birthdate : dd/mm/yyyy
Age : (this one will be automatically calculated by Pre-Parser module)
thanks in advance