This time I’ll show you how to print current date and time with Python.
You will need the datetime module for that.
The code
Thew code which I prepared is:
import datetime now = datetime.datetime.now() print("The current date and time is: ") print(now.strftime("%y-%m-%d %H:%M:%S"))
The output
And the output of the script is:
The current date and time is: 21-02-09 17:27:00
Now you know how to print date and time in Python. You know when I created this article 😉