You can use PyICU to parse a localized date / time string into this format :
#!/usr/bin/env python
It works on Python 2/3. It does not change the global state (locale).
If your actual input time string does not contain an explicit utc offset, you must specify the time zone that the ICU will use explicitly , otherwise you may get the wrong result (ICU and datetime may use different time zone definitions).
If you only need to support Python 3, and you do not mind setting the language, you can use datetime.strptime() as @alexwlchan :
#!/usr/bin/env python3 import locale from datetime import datetime locale.setlocale(locale.LC_TIME, "pt_PT.UTF-8") print(datetime.strptime("Ter, 01 Out 2013 14:26:00 -0300", "%a, %d %b %Y %H:%M:%S %z")) # works on Python 3.2+ # -> 2013-10-01 14:26:00-03:00
source share