django python date time set to midnight

Using datetimes’s “combine” with the time.min and time.max will give both of your datetimes.
For example:

from datetime import date, datetime, time
pub_date = date.today()
min_pub_date_time = datetime.combine(pub_date, time.min) 
max_pub_date_time = datetime.combine(pub_date, time.max)  

Result with pub_date of 6/5/2013:

min_pub_date_time -> datetime.datetime(2013, 6, 5, 0, 0)

max_pub_date_time -> datetime.datetime(2013, 6, 5, 23, 59, 59, 999999)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)