Python Dates

Python Date and time

let’s see how we can show the date and time in python

import datetime

x = datetime.datetime.now()
print(x)

output will be like this

Display the year and weekday name

import datetime

x = datetime.datetime.now()

print(x.year)
print(x.strftime("%A"))

out put will be like this 

Leave a Reply