How to get the current date and time in python ?

Spread the love

In this tutorial, you will learn how to write a program to get the current date and time in python ?

import datetime datetime = datetime.datetime.now() print("current date and time",datetime) date= datetime.date() print("current date ",date) time= datetime.time() print("current time",time)