Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to calculate the age from date of birth in python

SELECT CASE WHEN dateadd(year, datediff (year, DOB, getdate()), DOB) > getdate()
            THEN datediff(year, DOB, getdate()) - 1
            ELSE datediff(year, DOB, getdate())
       END as Age
FROM <table>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #calculate #age #date #birth #python
ADD COMMENT
Topic
Name
7+7 =