You are here: Home / Topics / Write a Python program to display the current date and time

Write a Python program to display the current date and time

Filed under: Python on 2023-09-18 06:48:38

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

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

Output:

Current date and time : 
2014-07-05 14:34:14 

About Author:
S
Shyam Dubey     View Profile
If you are good in any field. Just share your knowledge with others.