Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python timedelta years

from dateutil.relativedelta import relativedelta

def yearsago(years, from_date=None):
    if from_date is None:
        from_date = datetime.now()
    return from_date - relativedelta(years=years)
 
PREVIOUS NEXT
Tagged: #python #timedelta #years
ADD COMMENT
Topic
Name
1+2 =