Python ProgrammingPython Programming

How can I check whether an object is of type datetime.date?

import datetime

x = '2012-9-1'
y = datetime.date(2012, 9, 1)

print(isinstance(x, datetime.date))
print(isinstance(y, datetime.date))
Output
False
True