Skip to content
Live Timer

Date format tester

Type a format string and see the current time formatted with it, live. Switch between strftime and Unicode patterns.

 

strftime codes

CodeMeaningNow
%YYear with century
%yYear without century (00–99)
%mMonth (01–12)
%BFull month name
%bAbbreviated month name
%dDay of the month (01–31)
%eDay of the month, space-padded
%jDay of the year (001–366)
%AFull weekday name
%aAbbreviated weekday name
%uISO weekday (1 = Monday)
%wWeekday (0 = Sunday)
%VISO week number
%GISO week-based year
%UWeek of the year, Sunday start
%HHour, 24-hour clock (00–23)
%IHour, 12-hour clock (01–12)
%pAM or PM
%MMinute (00–59)
%SSecond (00–60)
%fMicroseconds (Python)
%zUTC offset (+hhmm)
%ZTime-zone abbreviation
%sUnix timestamp
%FSame as %Y-%m-%d
%TSame as %H:%M:%S
%DSame as %m/%d/%y
%RSame as %H:%M
%cLocale date and time
%-dNo padding (Linux, macOS)
%%A literal %

Unicode (LDML) pattern letters

PatternMeaningNow
yyyyYear
yyTwo-digit year
YYYYWeek-based year (careful!)
MMMMFull month name
MMMAbbreviated month name
MMMonth (01–12)
MMonth (1–12)
ddDay of the month (01–31)
dDay of the month (1–31)
DDay of the year
EEEEFull weekday name
EEEAbbreviated weekday
eLocal day of week number
wwWeek of the year
HHHour (00–23)
hhHour (01–12)
hHour (1–12)
KKHour (00–11)
kkHour (01–24)
aAM or PM
mmMinute (careful: not month)
ssSecond
SSSMilliseconds
XXXISO offset (Z or +hh:mm)
ZOffset (+hhmm)
ZZZZZOffset (+hh:mm)
zShort zone name
zzzzLong zone name
VVZone ID
QQQQuarter
'text'Literal text

Two families of format strings

strftime codes start with a percent sign, such as %Y-%m-%d %H:%M. They come from the C library and are used by Python, PHP’s strftime, Ruby, Go’s strftime libraries and shell date.

Unicode (LDML) patterns use repeated letters, such as yyyy-MM-dd HH:mm. They are used by Java’s DateTimeFormatter, Swift and Objective-C, ICU, Moment-style libraries and date-fns. Note the traps: mm is minutes but MM is months, and YYYY is the week-based year, which differs from yyyy around New Year.

Frequently asked questions

Can’t find an answer? Ask us.

Why did my date show the wrong year in late December?
You probably used YYYY (week-based year) instead of yyyy (calendar year). In the last days of December, the week-based year can already be the next year.

Related tools