Context: I am running this code on Python3.6.8 on Amazon Linux 2
I am having an issue with the datetime.datetime.strptime method throwing the following error:
ValueError: time data '2019-11-22T08:00:14-08:00' does not match format '%Y-%m-%dT%H:%M:%S%z'
I do not get this error when executing the same block of code on my Windows System. I believe it may be caused by the known compatibility issue of the %z directive on *Nix, but I was under the impression that this was fixed for version >3.2.
Was I misguided on this? If so, what is the general work around if I wanted to be able to parse timezone information from a timestamp on Amazon Linux 2?
def parse_pd_time_strings(timeString):
return dt.strptime(timeString,'%Y-%m-%dT%H:%M:%S%z')
Solution: This issue appears to be fixed on Python 3.7+. For my purposes updating the Python version is an acceptable option.
If you have a work around that works for users for whom updating is not an option, I'd still be fascinated to read it.
Note this issue appears to be fixed on Python 3.7+. For my purposes updating the Python version is an acceptable option.
If you have a work around that works for users for whom updating is not an option, I'd still be fascinated to read it.