Date patterns can be used 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 may produce different date displays. Using the character "y", which symbolizes "year" as an example, entering yy produces 99, whereas entering yyyy produces 1999. Often, the number of characters in a pattern also specifies its width. Using the character "h", which represents "hour" as an example, 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 will display.
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. For example:
|
M | Month of the year. The output depends on the number of M letters you enter. For example:
|
w | Week of the year. |
d | Day of the month. For example:
|
E | Day of the week. For example:
|
a | Produces either am or pm. |
H | Hour: 0-23. For example:
|
k | Hour: 1-24. For example:
|
K | Hour in am or pm: 0-11 |
h | Hour in am or pm: 1-12 |
m | Minute in an hour. For example:
|
s | Second in a minute. For example:
|
Other special characters | Other special characters will be 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 |