Custom Date and Time Field Display

A date or time pattern is a string of characters that will be replaced by the actual date and time value input in a field. The pattern determines what date or time information will be displayed, and how it will be displayed. Since the default date and time display options use the client computer settings, you can use a custom date, time or date/time field if you want to display dates and times consistently between client computers. You can also use them to display information not contained within the default date and time fields, such as the quarter or era.

The table below lists all of the possible elements of a date or time pattern, the symbol used to represent them, and an example of how the final value would be displayed. In some cases, the same element may have several different display options.  For example, the symbol y is used for the year, but you can control whether to display all four digits, such as "2024" (in which case you would use the pattern "y" or "yyyy"), or to display just the last two digits, such as "24" (in which case you would use the pattern "yy").

"Stand Alone" values refer to those designed to stand on their own, as opposed to being with other formatted values. if you want to store the current quarter alone, as “2nd quarter”, you would use the stand alone format (QQQQ), whereas “2nd quarter 2024” would use the regular format (qqqq yyyy). In some locales the “Stand Alone” outputs might differ from those of their regular symbol counterparts.

Description Symbol Example
Era Designator G AD
Year (full) y or yyyy 2024
Year (abbreviated) yy 24
Year for "Week of Year" Y 2024
Quarter (numeric) Q or QQ 02
Quarter (abbreviated) QQQ Q2
Quarter (full) QQQQ 2nd Quarter
Stand Alone Quarter (numeric) q or qq 02
Stand Alone Quarter (abbreviated) qqq Q2
Stand Alone Quarter (full) qqqq 2nd Quarter
Month (numeric) M or MM 09
Month (abbreviated) MMM Sept
Month (full) MMMM September
Month (initial) MMMMM S
Stand Alone Month (numeric) L or LL 09
Stand Alone Month (abbreviated) LLL Sept
Stand Alone Month (full) LLLL September
Stand Alone Month (initial) LLLLL S
Week of Year w 182
Week of Month W 2
Day of Month d 5
Day of Month (two-digit) dd 05
Day of Year D 205
Day of Week in Month (e.g., 2nd Wed. in July) f 2
Modified Julian Day Number g 2451334
Day of Week (abbreviated) E, EE or EEE Tues
Day of Week (full) EEEE Tuesday
Day of Week (initial) EEEEE T
Local Day of Week (if Mon. is 1, Tue. is 2, etc) e 3
Stand Alone Local Day of Week c 3
AM/PM marker a AM
Hours in AM or PM (1-12) h 7
Hours in AM or PM (1-12) (two-digit) hh 07
Hours in AM or PM (0-11) K 5
Hours in AM or PM (0-11) (two-digit) KK 05
Hours in Day (0-23) H 8
Hours in Day (0-23) (two-digit) HH 08
Hours in Day (1-24) k 20
Hours in Day (1-24) (two-digit) kk 20
Minute in Hour m 3
Minute in Hour (two-digit) mm 03
Second in Hour s 9
Second in Hour (two-digit) ss 09
Single Quote '' '

Letters may be included in the pattern, but they must be enclosed in single quotes. For example, the pattern "qqqq 'of' yyyy" would be returned as "2nd Quarter of 2024". Other characters besides single quotes and letters may be included as-is, without needing to be enclosed. For example, the pattern "hh:mm:ss" would return "09:15:45".

Examples

Pattern Result
yyyy-MM-dd hh:mm:ss a 2024-02-19 04:31:16 PM
EEE, MMM d, ''yy Wed, Feb 19, '09
qqqq 'of' yyyy 1st Quarter of 2024
h:mm a 4:31 PM