Given datetime.datetime.now(), how do I get this week’s Monday – Sunday and then the same Monday – Sunday for last year, considering leap years?
One idea I had was to get the timedelta for -365 days and then find the nearest Monday or Sunday. I’m sure there is a better way.
Edit: I don’t mind using datetuil, if there is something in there that’d make this easier.
If using dateutil is not a problem, just use it 🙂
The relativedelta is the object you need
Here you will be able to substract one year to the current date.