Skip to content

Instantly share code, notes, and snippets.

View moanesga's full-sized avatar

Mónica Espitia moanesga

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