Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python calculate age from date of birth

from datetime import date

def calculate_age(born):
    today = date.today()
    return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
Comment

how to find current age from date of birth in python

today_date = datetime.datetime.now()
dob = datetime.datetime(1982, 5, 20)
print(today_date - dob)
Comment

python calculate age from date of birth

#Python Calculate Age from date of birth:

from datetime import date

def calculate_age(born):
    today = date.today()
    return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
Comment

how to calculate the age from date of birth in python

SELECT DATEDIFF (
	year, DOB, getdate()) + CASE 
      WHEN (DATEADD(year,DATEDIFF(year, DOB, getdate()) , DOB) > getdate())
      THEN - 1 
      ELSE 0
END
)
Comment

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>
Comment

PREVIOUS NEXT
Code Example
Python :: how to remove data from mongo db python 
Python :: matplotlib title cilpped off 
Python :: text to speech to specific language python 
Python :: use of the word bruh over time 
Python :: open applications by python 
Python :: igraph adjacency matrix python 
Python :: pytest installation windows 
Python :: find two number in python 
Python :: pandas normalize df 
Python :: how to redirect to another page in django after login 
Python :: utc to local time python 
Python :: print nested list in new lines 
Python :: python strftime iso 8601 
Python :: selenium text returns empty string python 
Python :: pil image from numpy 
Python :: remove consecutive duplicates python 
Python :: python strip multiple characters 
Python :: standard module 
Python :: remove warnings from jupter notebook 
Python :: sns time series plot 
Python :: python find which os 
Python :: django import timezone 
Python :: insert video in tkinter 
Python :: check if numpy arrays are equal 
Python :: python project ideas 
Python :: remove duplicate row in df 
Python :: directory name python 
Python :: python your mom 
Python :: python get square root 
Python :: backwards loop over list in python 
ADD CONTENT
Topic
Content
Source link
Name
6+1 =