Source Code:
(back to article)
from datetime import datetime dt = datetime(2022, 1, 16, 12, 30, 45) date_string = dt.strftime('%Y-%m-%d') print(date_string) # Ausgabe: '2022-01-16'
Result:
Report an issue