Write a Python program to display the current date and time

Write a Python program to display the current date and time

Sample Output :
Current date and time :
2022-11-20 05:39:10

import datetime
now = datetime.datetime.now()
print ("Current date and time : ")
print (now.strftime("%Y-%m-%d %H:%M:%S"))

Result

Write a Python program to display the current date and time
Write a Python program to display the current date and time

 

 

 

 

 

 

Leave a Comment