-1

so I have a script that is pulling data out of our Zendesk(support CRM) installation and it's grabbing a couple of date fields via their REST API. The date fields come out like this: 2018-04-21T21:41:09Z and when I try to format it via Python, I get an error that the field itself is a string and won't accept strptime or strhtime. The exact error is:

AttributeError: 'str' object has no attribute 'strptime'

Any idea what I can do to convert this to something that I can reformat with strptime or the like? Python novice who is self-taught, so I'm probably missing something very obvious or basic.

nyi
  • 3,123
  • 4
  • 22
  • 45

1 Answers1

0

Use strptime:

datetime.datetime.strptime('2018-04-21T21:41:09Z', "%Y-%m-%dT%H:%M:%SZ")
arielnmz
  • 8,354
  • 9
  • 38
  • 66