close

[Solved] TypeError: descriptor ‘date’ for ‘datetime.datetime’ objects doesn’t apply to a ‘int’ object

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error TypeError: descriptor ‘date’ for ‘datetime.datetime’ objects doesn’t apply to a ‘int’ object in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How TypeError: descriptor ‘date’ for ‘datetime.datetime’ objects doesn’t apply to a ‘int’ object Error Occurs?

Today I get the following error 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 Error ?

  1. How To Solve TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object Error ?

    To Solve TypeError: descriptor 'date' for 'datetime.datetime' objects doesn't apply to a 'int' object Error 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.

Solution 1

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.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment