Answers for "TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object"

0

TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object

import datetime
my_date = datetime.date(2021, 3, 2)
# Or
from datetime import date
my_date = date(2021, 3, 2)
# The issue is that datetime.datetime.date() is a method on a datetime.datetime object. 
# We were confusing the datetime module with the datetime.datetime class.
# What we're really looking for is the datetime.date() constructor.
Posted by: Guest on July-05-2021

Code answers related to "TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object"

Python Answers by Framework

Browse Popular Code Answers by Language