Jun-14-2022, 10:27 PM
I'm working with an API that returns the time for events in this format:
2022-06-14T13:00:00-07:00
Can I presume that that's telling me local time with the UTC offset (-07:00) appended to it? Or would it be UTC with the offset included to produce local time?
This fails with "ValueError: 'z' is a bad directive in format '%Y-%m-%dT%H:%M:%S%z'":
datetime.datetime.strptime("2022-06-14T13:00:00-07:00", '%Y-%m-%dT%H:%M:%S%z')
I can chop off the offset easily enough, but I'm wondering if that's the best approach.
Thanks for any insights.
2022-06-14T13:00:00-07:00
Can I presume that that's telling me local time with the UTC offset (-07:00) appended to it? Or would it be UTC with the offset included to produce local time?
This fails with "ValueError: 'z' is a bad directive in format '%Y-%m-%dT%H:%M:%S%z'":
datetime.datetime.strptime("2022-06-14T13:00:00-07:00", '%Y-%m-%dT%H:%M:%S%z')
I can chop off the offset easily enough, but I'm wondering if that's the best approach.
Thanks for any insights.