Last active
June 2, 2018 12:55
-
-
Save moanesga/22f83cbbd7da44d954829da87e577ea5 to your computer and use it in GitHub Desktop.
Calculating range between tho given dates and printing result in X years X months X days
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
from dateutil import relativedelta | |
a = datetime(1985,1,1) | |
b = datetime(2000,1,28) | |
delta = relativedelta.relativedelta(b,a) | |
years = delta.years | |
months = delta.months | |
days = delta.days | |
print("Range of variable hire_date is",years, "years",months, "months", days, "days") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment