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

age calculator in python

import datetime 
Year_of_birth = int(input("In which year you took birth:- "))
current_year = datetime.datetime.now().year
Current_age = current_year - Year_of_birth
print("Your current age is ",Current_age)
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

Calculate age python

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

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

age calculator in python


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 do pandas profiling 
Python :: changing dtype of multiple columns to_datetime 
Python :: superscript print python 
Python :: pandas drop empty rows 
Python :: how to get user location in python 
Python :: matplotlib plot remove margins 
Python :: remove multiple space python 
Python :: python -m pip install --upgrade 
Python :: pick random entry in dict python 
Python :: how to find the calendar week python 
Python :: tracking mouse position tkinter python 
Python :: how to return the derivative of a function in python 
Python :: using regex validators in django models 
Python :: how to make a discord bot dm someone python 
Python :: datetime one week ago python 
Python :: jupyter read in csv 
Python :: how to remove first row of numpy array 
Python :: define a column as index pandas 
Python :: python except show error 
Python :: tkinter start maximized 
Python :: pandas dataframe histogram 
Python :: PySpark columns with null or missing values 
Python :: remove column from dataframe 
Python :: sparksession pyspark 
Python :: mnist fashion dataset 
Python :: pandas to csv encoding 
Python :: to int in pandas 
Python :: python detect tty 
Python :: how to separate x and y from mouse position python 
Python :: how to take user input in a list in python 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =