How to Get Current Time in Python

TProgram in python Current Date and Time in Python

Get Current Date and Time in Python

Fill in some text

from datetime import datetime today = datetime.now() print("Current Date and Time = ", today) # Formatting dt = today.strftime("%B %d, %Y %H:%M:%S") print("Current Date and Time = ", dt)

Example

Out Put of this program

Current Date and Time =  2022-06-01 15:32:09.414500 Current Date and Time =  June 01, 2022 15:32:09