I need to find "yesterday's" date in this format
MMDDYY in Python.
So for instance, today's date would be represented like this: 111009
I can easily do this for today but I have trouble doing it automatically for "yesterday".
>>> from datetime import date, timedelta >>> yesterday = date.today() - timedelta(days=1) >>> yesterday.strftime('%m%d%y') '110909'
from datetime import datetime, timedelta yesterday = datetime.now() - timedelta(days=1) yesterday.strftime('%m%d%y')