ISO date in Python strftime()
A plain calendar date, year-month-day, unambiguous worldwide.
Format string
%Y-%m-%d
Example output
2026-06-18
Edit this format in the live tester →
In Python
from datetime import datetime
dt = datetime(2026, 6, 18, 13, 45, 30)
dt.strftime("%Y-%m-%d")
# => "2026-06-18"
Directives used
| %Y | Year with century as a decimal number. | 2026 |
| %m | Month as a zero-padded number (01–12). | 06 |
| %d | Day of the month, zero-padded (01–31). | 18 |