Let’s say you need the current date and time from your system to place it in a Python application. For example to place the date and time as a timestamp in a blog application so the date and time when a blog article was posted will be visible on the screen.
For that, we need to import a module called
datetime which contains a class with the same name
>>> import datetime >>> current_datetime = datetime.datetime.now() >>> print(current_datetime) 2017-12-11 08:18:18.685000