pythonpython-3.xdatetimepython-arrow

Python Arrow timezone parsing


I'm trying to convert a string to DateTime object, The string:

Saturday 8th of August 2020 07:48:11 AM CDT

I'm using arrow package

arrow.get('Saturday 8th of August 2020 09:23:34 AM CDT', 'dddd Mt[h] of MMMM YYYY HH:mm:ss A ZZZ')

I'm getting the following error

arrow.parser.ParserError: Could not parse timezone expression "CDT"

I couldn't find any way to convert the CDN part into timezone.


Solution

  • Has said in the documentation, some abbreviations are ambiguous. You can use for example America/Chicago instead of CDT