mardi 3 mai 2016

Converting date to datetime object python

I have a date which I convert into iso format using:

#createDate is fetched from a json output of an API  
createDate = device['createDate']

# Convert into iso format
# Sample output value : 2014-11-13T16:23:19+00:00
create_date_utcFormat = dateparser.parse(createDate).astimezone(tz.tzutc()).isoformat()

When I try adding this object to DB I get SQLite DateTime type only accepts Python datetime and date objects as input. How can I convert create_date_utcFormat into datetime object?

Aucun commentaire:

Enregistrer un commentaire