You can use date patterns to control the way dates are displayed throughout a dashboard, such as on the category axis of a serial chart. A date pattern is a string of characters in which specific character strings are replaced with date and time data from a calendar.
In a date pattern, the number of instances you enter the same character in the Pattern setting produces different date displays. For example, using the character y, which symbolizes year, entering yy produces 99, whereas entering yyyy produces 1999. Often, the number of characters in a pattern also specifies its width. For example, using the character h, which represents hour, entering h in the Pattern setting produces 5, whereas entering hh produces 05. In other cases, the character count specifies whether abbreviated or full date information displays.
You can create date patterns with the characters described in the following table:
Character | Description |
---|---|
y | Year. The number of y letters represent digits of the year in the resulting date. See the following example:
|
M | Month of the year. The output depends on the number of M letters you enter. See the following example:
|
w | Week of the year. |
d | Day of the month. See the following example:
|
E | Day of the week. See the following example:
|
a | Produces either a.m. or p.m. |
H | Hour: 0–23. See the following example:
|
k | Hour: 1–24. See the following example:
|
K | Hour in a.m. or p.m.: 0–11 |
h | Hour in a.m. or p.m.: 1–12 |
m | Minute in an hour. See the following example:
|
s | Second in a minute. See the following example:
|
Other special characters | Other special characters are displayed as they are entered in the Pattern setting. For example, yyyy-MM-dd will produce 2013-03-01. |
The following are example date patterns:
Pattern | Result |
---|---|
M/d/yy | 10/1/17 |
MMMM d, yyyy | October 1, 2017 |
d MMM yy | 1 Oct 17 |
EEEE, MMMM d, yyyy | Sunday, October 1, 2017 |
yyyy | 2017 |
HH:mm:ss | 00:00:00 |
kk:mm:ss | 24:00:00 |
KK:mm:ss a | 11:00:00 am |
hh:mm:ss a | 12:00:00 pm |
hh:mm:ss | 12:00:00 |