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