I\'m currently writing some reporting code that allows users to optionally specify a date range. The way it works (simplified), is:
date = datetime.strftime('') date.replace(hour=0, minute=0, second=0, microsecond=0) # now we get begin of the day date += timedelta(days=1, microseconds=-1) # now end of the day