How to convert date in Python from 2021-01-11 as YYYY-MM-DD to dd:mm:yyyy like 11:01:2021?
2021-01-11
YYYY-MM-DD
dd:mm:yyyy
11:01:2021
You can do that in a very simple way with datetime:
import datetime original_date = datetime.datetime.strptime("2021-01-11", '%Y-%m-%d') formatted_date = original_date.strftime("%d:%m:%Y")
datetime documentation
2.1m questions
2.1m answers
60 comments
57.0k users