DEV Community

Nilotpal Choudhury
Nilotpal Choudhury

Posted on

Answer: Python: how can I check whether an object is of type datetime.date?

right way is

import datetime
isinstance(x, datetime.date)

When I try this on my machine it works fine. You need to look into why datetime.date is not a class. Are you perhaps masking it with something else? or not referencing it correctly for your import?

Top comments (0)