+3 votes
in Programming Languages by (19.0k points)
How can I calculate the age of a person in days using Python code?

1 Answer

+2 votes
by (29.7k points)

The datetime module supplies classes for manipulating dates and times. You can use the date class of this module to compute the age in days.

Here is an example:

from datetime import date

currentdate = date.today()

birthday = date(1988, 11, 10)

age = currentdate - birthday