May I know is there anyway to calculate age from user input date and minus my database date?
the user input format is as per asian format (dd/mm/yyyy) while database date was store under date type and format as Y-m-d
How do I calculate it and return to $age variables?
Here is my code that I use to execute the data.
//Date that user keyin
$userDate = $_POST['dob'];
$dateTime = DateTime::createFromFormat('d/m/Y', $userDate);
$myFormat = $dateTime->format('Y-m-d');
//Query execute
$statement->execute(array('date'=>$myFormat));
Please advise, thank you.
Sorry for my bad english.