In this python basic program, we will get the current date and time using datetime library.
Steps to solve the program
- Import datetime library.
- Get the current date and time using datetime.datetime.now().
- Print the output.
import datetime
dt = datetime.datetime.now()
print("Current Date: ",dt)
Output :
Current Date: 2023-01-29 09:52:33.631419