Google News
logo
Python Program to Create a date object
In the following example of Python program that creates a date object :
Program :
import datetime

# Create a date object for January 1, 2022
d = datetime.date(2022, 1, 1)

# Print the date object
print(d)
Output :
2022-01-01