HomeDocs › %b

Python strftime directive %b

Abbreviated month name in the current locale.

Example (from datetime(2026, 6, 18, 13, 45, 30))
Jun
Output depends on the active locale; in Python it follows the process locale (locale.setlocale). This page and the tester show the C/English value.

In Python

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

Parsing with strptime

Parses an abbreviated month name (locale-dependent). See strptime.dev for the parsing side.

Try %b in the live tester →

Other Month directives