HomeDocs › %S

Python strftime directive %S

Second, zero-padded (00–59; up to 61 historically for leap seconds).

Example (from datetime(2026, 6, 18, 13, 45, 30))
30

In Python

from datetime import datetime
dt = datetime(2026, 6, 18, 13, 45, 30)
dt.strftime("%S")
# => "30"

Parsing with strptime

Parses a 1- or 2-digit second. See strptime.dev for the parsing side.

Try %S in the live tester →

Other Time directives