If you want to get the date and time of yesterday, you can create a timedelta for one day and pull the date object as it is.
>>> import datetime
>>> from datetime import timedelta
>>> t = timedelta(days = 1)
>>> d = datetime.date.today()
>>> d
datetime.date(2013, 3, 27)
>>> d - t
datetime.date(2013, 3, 26)
8.1. datetime — basic date and time types
Recommended Posts