Python dates
In Python, handling dates typically involves using the `datetime` module, which provides classes for manipulating dates and times. This module includes classes like `datetime.date` for date objects, `datetime.time` for time objects, and `datetime.datetime` for combined date and time objects. It also supports operations for formatting dates, calculating time differences, and working with time zones.
import datetime
#Current date
x = datetime.datetime.now()
print(x)
print(x.year)
print(x.strftime("%A"))
#Another date
x = datetime.datetime(2020, 5, 17)
print(x)
print(x.strftime("%B"))
Python Online Compiler