Python: get datetime for '3 years ago today'?
Question: This must be a duplicate (and documented), but I can't find the answer via
Google.

In Python, how do I get a datetime object for '3 years ago today'?

Thanks!

UPDATE: FWIW, I don't care hugely about accuracy... i.e. it's Feb 29th today,
I don't care whether I'm given Feb 28th or March 1st in my answer. Concision
is more important than configurability, in this case.


Answer: If you need to be exact use the
[dateutil](https://pypi.python.org/pypi/python-dateutil/2.1) module to
calculate relative dates

    
    
    from datetime import datetime
    from dateutil.relativedelta import relativedelta
    
    three_yrs_ago = datetime.now() - relativedelta(years=3)
    

