time() method of Python's
time module returns the seconds since the epoch (1/1/1970 at midnight). To convert the number of seconds to years with Python, divide by seconds in a minute, minutes in an hour, hours in a day, and days in a year.
time.time()will return something in the neighborhood of
import time seconds = time.time() print(seconds)
minutes = seconds / 60 print(minutes)
hours = minutes / 60 print(hours)
days = hours / 24 print(days)
years = days / 365.25 print(years)
Or you can do it all in one step, like this:
Nat Dunn founded Webucator in 2003 to combine his passion for web development with his business expertise and to help companies benefit from both.