Skip to content

Instantly share code, notes, and snippets.

Avatar

Mónica Espitia moanesga

View GitHub Profile
@moanesga
moanesga / DateDifference_YYYY,MM,DD.py
Last active Jun 2, 2018
Calculating range between tho given dates and printing result in X years X months X days
View DateDifference_YYYY,MM,DD.py
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")