How do I convert a datetime to date?


How do I convert a datetime.datetime object (e.g., the return value of to a object in Python?

Answer rating: 1247

Use the date() method:

Answer rating: 149

From the documentation:

Return date object with same year, month and day.

Get Solution for free from DataCamp guru