HomeDocs › %-I

Python strftime directive %-I

12-hour hour with no leading zero. Platform-specific (Linux/macOS).

Example (from datetime(2026, 6, 18, 13, 45, 30))
1
This directive uses the - modifier, which is platform-specific (Linux/macOS, glibc). It is not supported on Windows.

In Python

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

Parsing with strptime

Not used for parsing. See strptime.dev for the parsing side.

Try %-I in the live tester →

Other Time directives