how to remove time in datetime in python 1

how to remove time in datetime in python

import datetime
date_and_time = datetime.datetime(2019, 12, 30)
date = date_and_time.date()
print(date)

Here is what the above code is Doing:
1. We import the datetime module.
2. We create a datetime object with the year, month, and day.
3. We create a date object by calling the date() method on the datetime object.
4. We print the date object.

Similar Posts