I am trying to parse the following date time:
stripped_most_recent = 2017-03-22 14:07:50.000Z
timestamp = (datetime.datetime.strptime(str(stripped_most_recent), "%Y-%m-%d %H:%M:%S.%f"))
Returns the following error:
ValueError: time data '2017-03-22 14:07:50' does not match format '%Y-%m-%d %H:%M:%S.%f'
Whereas, this timestamps causes no problems at all:
2017-03-22 14:07:30.181Z
I have seen this answer here, but dont understand why .000 does not work, whereas anything else is fine.
I think the solution is to remove the .000 completely from the string? As per this answer: What is the best way to do this?
Thanks,
PS I have also tried:
timestamp = (datetime.datetime.strptime(str(stripped_most_recent), "%Y-%m-%d %H:%M:%S.%fZ"))