Custom Date and Time Formats
You can customize how date and time values are formatted in your filter and parameter
controls using a combination of supported tokens. For example, you can format the
date as Sep 20, 2024 or as 09-20-2024.
Supported Tokens for Formatting Dates
Example | Description | Token |
---|---|---|
0–6 | Numeric representation of a particular day of the week. 0 is Sunday and 6 is Saturday. | d |
Mo–Su | A 2-character textual representation of a particular day of the week. | dd |
Mon–Sun | A 3-character textual representation of a particular day of the week. | ddd |
Monday–Sunday | A textual representation of a particular day of the week. | dddd |
99 or 24 | A 2-digit representation of a year. | YY |
1999 or 2024 | A full, 4-digit numeric representation of a year. | YYYY |
1–12 | Number of a month without leading zeros. | M |
1st, 2nd, to 12th | Number of a month without leading zeros and with an ordinal suffix. | Mo |
01–12 | Number of a month with leading zeros. | MM |
Jan–Dec | A 3-digit textual representation of a month. | MMM |
January–December | A full textual representation of a month. | MMMM |
1–4 | A numeric representation of a quarter. | Q |
1st–4th | A numeric representation of a quarter with an ordinal suffix. | Qo |
1–31 | Day of the month without leading zeros. | D |
1st, 2nd, to 31st | Day of the month without leading zeros and with an ordinal suffix. | Do |
01–31 | A 2-digit day of the month with leading zeros. | DD |
1–365 | Day of the year without leading zeros. | DDD |
001–365 | Day of the year with leading zeros. | DDDD |
1–53 | Week of the year without leading zeros. | w |
1st–53rd | Week of the year without leading zeros and with an ordinal suffix. | wo |
01–53 | Week of the year with leading zeros. | ww |
1–23 | Hours, in a 24-hour format, without leading zeros. | H |
01–23 | Hours, in a 24-hour format, with leading zeros. | HH |
1–12 | Hours, in a 12-hour format, without leading zeros. | h |
01–12 | Hours, in a 12-hour format, with leading zeros. | hh |
0–59 | Minutes without leading zeros. | m |
00–59 | Minutes with leading zeros. | mm |
0–59 | Seconds without leading zeros. | s |
00–59 | Seconds with leading zeros. | ss |
am or pm | am/pm | a |
AM or PM | AM/PM | A |
1632184215 | Unix timestamp. | X |
1632184215000 | Millisecond Unix timestamp. | x |
Z | Zero UTC offset. | Z |
Examples of Common Date Formats
Example | Token Format |
---|---|
Sep 20, 2024 | MMM DD, YYYY |
20-09-24 5pm | DD-MM-YY ha |
Monday, September 20, 2024 17:30:15 | dddd, MMMM DD, YYYY HH:mm:ss |
These formats are not supported:
- Time zones offset with a colon. For example, +07:00.
- Time zones offset without a colon. For example, +0730.
To quickly customize dates and times, you can use one of the available preset tokens.
Preset Date Formats
Example | Token |
---|---|
8:30 PM | LT |
8:30:25 PM | LTS |
August 2 2024 | LL |
Aug 2 2024 | ll |
August 2 2024 08:30 PM | LLL |
Aug 2 2024 08:30 PM | lll |
Thursday, August 2 2024 08:30 PM | LLLL |
Thu, Aug 2 2024 08:30 PM | llll |
You can also include words in date formats by entering backslashes (\) before each character in the word. For example, for the format 20th of Sep, 2024 use Do \o\f MMM, YYYY.