Source Code:
(back to article)
from datetime import datetime # Get the current date now = datetime.now() # Use strftime() to format the date date_string = now.strftime("%Y-%m-%d") print(date_string) # Output: "2022-12-01"
Result:
Report an issue