0

I need to convert a text string '2017-08-09T15: 00: 39.000Z' to hour format, to do operations with it

Mohd
  • 5,523
  • 7
  • 19
  • 30
jbangue85
  • 17
  • 2
  • 6
  • `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

0 Answers0