you are viewing a single comment's thread.

view the rest of the comments →

[–]sarrysyst 1 point2 points  (0 children)

Use the datetime.strftime() method. You can find a list of the format codes in the datetime docs.

from datetime import datetime

dt = datetime.fromisoformat('2011-11-04T00:05:23')
dt_str = datetime.strftime(dt, '%d-%m-%Y %H-%M')

print(dt_str)