Write a Python program to get the current date and time with an example. For example, in this programming language, we have a datetime module to work with or print the current date and time, and it will display the output.
from datetime import date today = date.today() print("Current Date = ", today)
Current Date = 2021-11-06
from datetime import datetime today = datetime.now() print("Current Date and Time = ", today) # Formatting dt = today.strftime("%B %d, %Y %H:%M:%S") print("Current Date and Time = ", dt)