You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A language-agnostic reference for date/time format patterns. Two major conventions exist — strftime (C, Python, Ruby, Go, PHP, etc.) and UTS#35 / CLDR tokens (Java, Kotlin, Swift, Dart, JavaScript via Intl, etc.). Both are shown side by side.
Day
Concept
Example output
strftime
UTS#35 tokens
Day of month
1, 29
%-d
d
Day of month padded
01, 29
%d
dd
Day of week (short)
Fri
%a
E
Day of week (full)
Friday
%A
EEEE
Day of year
88
%j
D
Month
Concept
Example output
strftime
UTS#35 tokens
Month number
3, 12
%-m
M
Month padded
03, 12
%m
MM
Month name (short)
Mar
%b
MMM
Month name (full)
March
%B
MMMM
Year
Concept
Example output
strftime
UTS#35 tokens
2-digit year
19
%y
yy
4-digit year
2019
%Y
yyyy
Time
Concept
Example output
strftime
UTS#35 tokens
Hour 24h
9, 13
%-H
H
Hour 24h padded
09, 13
%H
HH
Hour 12h
1, 3
%-I
h
Hour 12h padded
01, 03
%I
hh
Minute
5, 45
%-M
m
Minute padded
05, 45
%M
mm
Second
0, 9
%-S
s
Second padded
00, 09
%S
ss
AM/PM marker
AM, PM
%p
a
Timezone
Concept
Example output
strftime
UTS#35 tokens
UTC offset
+0200
%z
Z
UTC offset with colon
+02:00
%:z
xxx
Timezone abbreviation
CET
%Z
zzz
Timezone name (full)
Central European Time
—
zzzz
Format String Examples
Output
strftime pattern
UTS#35 pattern
07/25/2019 13:45:00
%m/%d/%Y %H:%M:%S
MM/dd/yyyy HH:mm:ss
Friday, March 29, 2019, at 3:00 PM
%A, %B %-d, %Y, at %-I:%M %p
EEEE, MMMM d, yyyy, 'at' h:mm a
2019-07-25 (ISO 8601 date)
%Y-%m-%d
yyyy-MM-dd
2019-07-25T13:45:00 (ISO 8601 datetime)
%Y-%m-%dT%H:%M:%S
yyyy-MM-dd'T'HH:mm:ss
In UTS#35, literal text inside a pattern must be wrapped in single quotes: 'at', 'T'.
In strftime, literal characters are written as-is (except %, which is escaped as %%).
Conventions at a Glance
Convention
Used in
Escape literal text
strftime
C, Python, Ruby, Go, PHP, Rust (chrono)
Write as-is (%% for %)
UTS#35/CLDR
Java, Kotlin, Swift, Dart, JS Intl
Wrap in 'single quotes'
ISO 8601
Universal interchange format (not a pattern)
N/A — fixed structure
Notes
Padding — most strftime implementations use %- to strip zero-padding (Linux) or # (Windows). UTS#35 pads by repeating the letter (d vs dd).
AM/PM / day names are locale-sensitive in both conventions. Pin the locale explicitly when you need consistent English output.
ISO 8601 (yyyy-MM-dd, HH:mm:ss, Z) is the safest choice for storage and data exchange — it sorts lexicographically and is unambiguous.