python - locale in dateutil / parser
dateutil.parser
doesn't use locale
. You'll need to subclass dateutil.parser.parserinfo
and construct a German equivalent:.
from dateutil import parser
class GermanParserInfo(parser.parserinfo):
WEEKDAYS = [("Mo.", "Montag"),
("Di.", "Dienstag"),
("Mi.", "Mittwoch"),
("Do.", "Donnerstag"),
("Fr.", "Freitag"),
("Sa.", "Samstag"),
("So.", "Sonntag")]
s = 'Montag, 11. April 2016 19:35:57'
note_date = parser.parse(s, parserinfo=GermanParserInfo())
You'd need to extend this to also work for other values, such as month names.