Need to change a string in German into a date. I try to use the following code:
from datetime import datetime
datetime_object = datetime.strptime('24. Juli 2017', '%d %B %Y')
print(datetime.strftime(datetime_object, '%d.%m.%Y'))
this code fails with the next error:
ValueError: time data '24. Juli 2017' does not match format '%d %B %Y'
However it works correct with English text:
datetime_object = datetime.strptime('24 July 2017', '%d %B %Y')
print(datetime.strftime(datetime_object, '%d.%m.%Y'))
Output:
24.07.2017