HomeDocs › %u

Python strftime directive %u

Weekday as a decimal number, 1=Monday … 7=Sunday (ISO 8601).

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

In Python

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

Parsing with strptime

Parses an ISO weekday 1–7 (Monday is 1). See strptime.dev for the parsing side.

Try %u in the live tester →

Other Weekday directives