► Python program to display the current date and time
Steps followed:
1. import datetime library
2. fetch the current time from datetim library and store it in variable now
3. print current date and time
#Python program to display the current date and time
#import datetime python library
import datetime
#fetch the current time from datetim library and store it in variable now
now = datetime.datetime.now()
#print current date and time
print("current date and time is:",now)
current date and time is: 2021-08-08 11:55:09.893219