When translating dates to JSON, javascript is saving dates in this format:
2012-05-29T19:30:03.283Z
However, I am not sure how to get this into a python datetime object. I've tried these:
# Throws an error because the 'Z' isn't accounted for:
datetime.datetime.strptime(obj[key], '%Y-%m-%dT%H:%M:%S.%f')
# Throws an error because '%Z' doesn't know what to do with the 'Z'
# at the end of the string
datetime.datetime.strptime(obj[key], '%Y-%m-%dT%H:%M:%S.%f%Z')
I believe that javascript is saving the string in official ISO format, so it seems that there should be a way to get python's datetime.strptime()
to read it?