+ 1

Help me fix my code. (Date format change)

I want to accept date in either mm/dd/YYYY format and change it to dd/mm/YYYY format. I'm not getting any output. Here's my code. import datetime dt = input() if(dt=='%m/%d/%Y'): format_str = '%m/%Y/%d' dt = datetime.datetime.strptime(dt, format_str) print(dt.date())

25th Feb 2020, 2:33 PM
Marvellous Abia
Marvellous Abia - avatar
1 Answer
+ 3
if you want to change mm/dd/yyyy to dd/mm/yyyy https://code.sololearn.com/cvFMz5I0vzOX/?ref=app but if you want something else ...
25th Feb 2020, 4:39 PM
Semeniuk Bohdan
Semeniuk Bohdan - avatar