HomeCommon › ISO 8601

ISO 8601 in Python strftime()

The international standard timestamp used by APIs, logs, and databases.

Format string
%Y-%m-%dT%H:%M:%S%z
Example output
2026-06-18T13:45:30

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-%dT%H:%M:%S%z")
# => "2026-06-18T13:45:30"

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
%HHour (24-hour clock), zero-padded (00–23).13
%MMinute, zero-padded (00–59).45
%SSecond, zero-padded (00–59; up to 61 historically for leap seconds).30
%zUTC offset as ±HHMM (empty if the datetime is naive). 

Related formats