I have a Django app with a model that contains a field of type DateTimeField. I am pulling data from the web in the format of 2008-04-10 11:47:58-05. I
2008-04-10 11:47:58-05
I've been using this:
from django.utils.timezone import get_current_timezone from datetime import datetime tz = get_current_timezone() dt = tz.localize(datetime.strptime(str_date, '%m/%d/%Y'))