In my django app I am getting the date returned in the following format
2021-01-05T23:19:30.685658Z
How do I convert this to dd-mm-yyyy?
In my django app I am getting the date returned in the following format
2021-01-05T23:19:30.685658Z
How do I convert this to dd-mm-yyyy?
you can use
from datetime import datetime
dt = datetime.fromisoformat('2021-01-05T23:19:30.685658Z'[:-1])
dt = dt.strftime('%Y-%m-%d')
print(dt)
result will be 2021-01-05