Skip to content

Format Specifiers

The complete specifier table for format() and ZEpoch.parseFormat(). Literals are escaped with brackets: format('[Week] W [of] YYYY').

Uppercase F specifiers include the decimal point and omit the entire fractional component when its value is zero. Lowercase f specifiers do not include a decimal point and always emit at least one digit. Both forms remove insignificant trailing zeros. For example, 10,000,000 nanoseconds formats as .01 with FFF and 01 with fff.

SpecifierMeaningExampleNotes
YYYY4+ digit year20244 digits normally; signed 6-digit expanded years outside 0000..9999
YY2-digit year (absolute)24Zero-padded to 2 digits
GGGG4+ digit ISO week year20244 digits normally; signed 6-digit expanded years outside 0000..9999
GG2-digit ISO week year (absolute)24Zero-padded to 2 digits
EEEra long formBefore ChristFull era name for the current calendar
EEra short formBCGregorian uses AD/BC; other calendars fall back to the full era name
WWWeek of year (2-digit)03Zero-padded week number
WWeek of year (unpadded)3Unpadded week number
QQISO Quarter (2-digit)01Zero-padded ISO quarter number
QISO Quarter (1..4)1Single digit ISO quarter
MMMMFull month nameJanuaryLocalized month name
MMMAbbreviated month nameJanLocalized abbreviated month
MMCalendar month number (2-digit)01Calendar-specific; zero-padded for positive one-digit months
MCalendar month number1Calendar-specific unpadded month number
DAYSDays in month31Number of days in current month
DDDDay of year (3-digit)014Calendar-specific; zero-padded to 3 digits
DSDay of month (1 or 2-digit)' 9'1..31, space-padded
DDDay of month (2-digit)0901..31, zero-padded
DDay of month (1..31)9Unpadded day of month
ddddFull weekday nameSundayLocalized weekday full name
dddWeekday abbreviationSunLocalized weekday abbr
ddISO Day of week number (1=Monday..7=Sunday)1Numeric weekday
dDay of week number (0=Sunday..6=Saturday)0Numeric weekday
hh12-hour (zero-padded)0201..12, zero-padded
h12-hour (unpadded)2Unpadded 12-hour
HH24-hour (zero-padded)0200..23 padded
H24-hour (unpadded)2Unpadded 24-hour hour
mmMinutes (2-digit)0800..59, zero-padded
mMinutes (unpadded)8Unpadded minutes
ssSeconds (2-digit)0900..59, zero-padded
sSeconds (unpadded)9Unpadded seconds
FFFOptional nanosecond fraction.004362713Includes .; up to 9 digits; empty when zero
FFOptional microsecond fraction.004362Includes .; up to 6 digits; empty when zero
FOptional millisecond fraction.004Includes .; up to 3 digits; empty when zero
fffNanosecond fraction digits004362713No decimal point; up to 9 digits; 0 when zero
ffMicrosecond fraction digits004362No decimal point; up to 6 digits; 0 when zero
fMillisecond fraction digits004No decimal point; up to 3 digits; 0 when zero
AMeridiem (locale form)AMLocalized meridiem
aMeridiem (lowercase)amLowercased localized meridiem
OOOOffset decorated (+-HH:mm or +-HH:mm:ss)-05:00With colon, always includes minutes
OOOffset standard (+-HHmm or +-HHmmss)-0500Without colon, always includes minutes
OOffset compact (+-HH or +-HHmm or +-HHmmss)-05Omits seconds and/or minutes when zero; -0530 when non-zero
ZIANA time zone nameAmerica/New_YorkFull IANA zone name
zTime zone abbreviationESTDerived from Intl parts; runtime-dependent
XXXXEpoch (nanoseconds)1705233600123456789Nanoseconds since epoch
XXXEpoch (microseconds)1705233600123456Microseconds since epoch
XXEpoch (milliseconds)1705233600123Milliseconds since epoch
XEpoch (seconds)1705233600Seconds since epoch
LLocaleen-USReturns configured locale string
CCalendar systemhebrewReturns configured calendar name