Date and Time Format Patterns


The following values are available for use in date format patterns:

Symbol
Meaning
Presentation
Examples
aAM or PMTextPM
dDay of month (1-31)Number5, 27
ddDay of month (01-31)Number05, 20
D or DDDay of year (1-366)Number4, 55, 189
DDDay of year (01-366)Number04, 55, 189
eDay of week (1-7, where Monday is 1)Number2
EDay of week, shortenedTextTue
EEEEDay of week in fullTextTuesday
GEraTextBC, AD
hHour in AM or PM (1-12)Number5
hhHour in AM or PM (01-12)Number05
HHour of day in 24 hour format (0-23)Number6
HHHour of day in 24 hour format (00~23)Number06
kHour of day in 24 hour format (0-24)Number9
kkHour of day in 24 hour format (00~24)Number09
KHour in AM or PM (0-11)Number3
KKHour in AM or PM (00-11)Number03
mMinute of hour (1-60)Number5
mmMinute of hour (01-60)Number05
MNumeric month (1-12)Number7
MMNumeric month (01-12)Number07
MMMNamed month, shortenedTextJUL
MMMMNamed month in fullTextJULY
sSeconds of minute (1-60)Number7
ssSeconds of minute (01-60)Number07
SFraction of secondNumber978
TTimeNumber080130, 00:00:00.000
wWeek of yearNumber27
xWeekyearYear1996
yYearYear1996
yyYearYear96
yyyyYearYear1996
YYear of era (>=0)Year1996
YYYear of era (>=0)Year96
YYYYYear of era (>=0)Year1996
ZTime zone offset/idZone-0800
ZZTime zone offset/idZone-08:00
ZZZTime zone offset/idZoneAmerica/Los_Angeles
'Escape for textDelimiter
''Single quoteLiteral'




The following formats are not available in Date Time Formats:
CCentury of era (>=0)Number20
KHour of halfday (0~11)Number3
KKHour of halfday (0~11)Number03
kClockhour of day (1~24)Number14
kkClockhour of day (1~24)Number14

The following format is not available for use in toString, which will instead return the same as Z. 

The time zones supported will be dependent on your server settings. Unsupported time zones will result in an error during analysis.

zTime zoneText

PST

The number of letters used in the pattern determines the format.

  • Text: If the number of pattern letters is 4 or more, the full form is used; otherwise a short or abbreviated form is used if available.
  • Number: The minimum number of digits. Shorter numbers are zero-padded to this amount.
  • Year: Numeric presentation for year and weekyear fields are handled specially. For example, if the count of 'y' is 2, the year will be displayed as the zero-based year of the century, which is two digits.
  • Month: 3 or over, use text, otherwise use number.
  • Zone: 'Z' outputs offset without a colon, 'ZZ' outputs the offset with a colon, 'ZZZ' or more outputs the zone id.
  • Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '?' will appear in the resulting time text even they are not embraced within single quotes.