Python strftime directive %m
Month as a zero-padded number (01–12).
Example (from datetime(2026, 6, 18, 13, 45, 30))
06
In Python
from datetime import datetime
dt = datetime(2026, 6, 18, 13, 45, 30)
dt.strftime("%m")
# => "06"
Parsing with strptime
Parses a 1- or 2-digit month. See strptime.dev for the parsing side.