Skip to content

Instantly share code, notes, and snippets.


Mónica Espitia moanesga

View GitHub Profile
moanesga / DateDifference_YYYY,MM,
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,
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")