Python strftime directive %W
Week of the year, Monday as the first day (00–53). Days before the first Monday are week 0.
Example (from datetime(2026, 6, 18, 13, 45, 30))
24
In Python
from datetime import datetime
dt = datetime(2026, 6, 18, 13, 45, 30)
dt.strftime("%W")
# => "24"
Parsing with strptime
Parses a week number; needs a weekday to resolve a date. See strptime.dev for the parsing side.