How to Format Date Objects Into Readable Strings in Python


In this example we will show how to format date objects into readable strings in Python.

Source Code

import datetime

a = datetime.datetime(2020, 6, 28)

print(a.strftime("%Y"))

Output:

2020
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments