I'm trying to parse time using strptime:
t = datetime.strptime('2024-08-21T11:00:00 EDT', '%Y-%m-%dT%H:%M:%S %Z')
This code works for me in GMT+4, but it fails in GMT-9:
ValueError: time data '2024-08-21T11:00:00 EDT' does not match format '%Y-%m-%dT%H:%M:%S %Z'
What am I doing wrong?
According to python docs strptime() only accepts certain values for %Z
Testing locally
Results
For a supported TZ
Even error string changes for some TZ.
America/Los_Angelesreturns error as reported by OP.Fails anyway even if tzname has values