To solve TypeError: descriptor ‘date’ for ‘datetime.datetime’ objects doesn’t apply to a ‘int’ object error follow below methods.
ERROR LOG
TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object
How to solve TypeError: descriptor ‘date’ for ‘datetime.datetime’ objects doesn’t apply to a ‘int’ object ?
Refer the given methods to solve the issue.
Method 1:
Datetime.datetime.date() is a method on a datetime.datetime object, which is the problem. We had mixed up the datetime module and the datetime.datetime class.
The function Object() { [native code] } datetime.date() is what we’re looking for.
import datetime
my_date = datetime.date(2022, 4, 3)
Method 2 :
from datetime import date
my_date = date(2022, 4, 3)
Hope the above solution works.
Also read :
sqlalchemy.exc.NoSuchModuleError: Can’t load plugin: sqlalchemy.dialects:postgres