Age-calculation

From VPOIDS Documentation

To make sure that ages (of passengers primarily) are calculated in a consistent manner, AFIDS uses these methods throughout:

In Sql:

  • TIMESTAMPDIFF(YEAR, dob, now()) as year
  • TIMESTAMPDIFF(MONTH, dob, now()) as month
  • TIMESTAMPDIFF(DAY, dob, now()) as day

The MySql function takes into consideration leap years.

In PHP:

  • TBD

Other rules about ages:

  • Whenever possible, calculate the age in the database query
  • Children passengers are under 18 (< 18) at the time of the mission
  • Age of passengers is most often calculated as a function of the date of the mission