I need to convert a text string '2017-08-09T15: 00: 39.000Z'
to hour format, to do operations with it
Asked
Active
Viewed 38 times
0
-
`from datetime import datetime; datetime.strptime('2017-08-09T15: 00: 39.000Z', '%Y-%m-%dT%H: %M: %S.%fZ')`. – Abdou Aug 09 '17 at 16:44
-
Get the following error "ValueError: time data '2017-08-09T15:00:39.000Z' does not match format '%Y-%m-%dT%H: %M: %S.%fZ'" – jbangue85 Aug 09 '17 at 17:05
-
That's because the string you posted here is different from the one you're working with in your console. The whitespace characters matter very much: Try `from datetime import datetime; datetime.strptime('2017-08-09T15:00:39.000Z', '%Y-%m-%dT%H:%M:%S.%fZ')`. – Abdou Aug 09 '17 at 17:34