HomeCommon › ISO date

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

%YYear with century as a decimal number.2026
%mMonth as a zero-padded number (01–12).06
%dDay of the month, zero-padded (01–31).18

Related formats