On a form, the user must enter the date of birth. PHP should control if he has already accomplished 18 years.
$birth = $_POST['data_nascita'];
$str_birth = strtotime ($birth );
$today = date("m/d/Y");
$str_today = strtotime ($today);
if($today - $str_today < 567648000) {
echo'you can't drive a car in Italy because you are underage';exit();
}
// 18 years * 31536000 second in 1 year = 567648000
If I put on birth field the date of 14 September 1998 (today is 13 September 2016, so 18 years don't entirely spend yet), the control doesn't work; it works starting from 15 September 1998.
Why I lost 2 days?