How to Get Information About Date Object in Python


In this example, we will learn how to get information about the date object in Python.

Source Code

import datetime

a = datetime.datetime.now()

print(a.year)
print(a.month)
print(a.strftime("%B"))
print(a.day)

Output:

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