Source Code:
(back to article)
from datetime import datetime dt_str = "2022-01-16 12:30:45" dt = datetime.strptime(dt_str, "%Y-%m-%d %H:%M:%S") date_object = dt.date() print(date_object) # Output: 2022-01-16
Result:
Report an issue