Print Date Time in Python

thumbnail

In this tutorial, you will learn to print date time in python. You need to import datetime library. The program to print date time is so simple, you can read the code as follows.

# Created by inpows
# Visit inpows.com for more python tutorials

import datetime

nowDateTime = datetime.datetime.now()

print("Current Date and Time: ", nowDateTime.strftime("%Y-%m-%d %H:%M:%S"))
Back To Top