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:
M
Mr. Dubey     View Profile
Founder of MCQ Buddy. I just like to help others. This portal helps students in getting study material free. Share your stuff here so that others can get benefitted.