How to calculate age from date of birth

This example uses the age module to calculate age from DOB (date of birth),  allowing for leap years (based on the Gregorian Calendar).

Note: The age module uses dateparse so it accepts most common date formats.

Here is an example code working using the date from an HL7 message, then the same date hard coded in two different formats:

You can get this code from our repository.

Leave A Comment?

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.