Format dates

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:

CharacterDescription

y

Year. The number of y letters represent digits of the year in the resulting date.

For example:

  • yy = 05 (always two digits)
  • yyyy = 2005

M

Month of the year. The output depends on the number of M letters you enter.

For example:

  • M = 8 (one or two digits)
  • MM = 08 (always two digits)
  • MMM = Aug (three-letter month abbreviation)
  • MMMM = August (full name of the month)

w

Week of the year.

d

Day of the month.

For example:

  • d = 7 (one or two digits)
  • dd = 07 (always two digits)

E

Day of the week.

For example:

  • E = 2 (single-digit for a week day)
  • EE = 02 (two-digit representation for a week day)
  • EEE = Tue (three-letter day of the week abbreviation)
  • EEEE = Tuesday (full name of the day)

a

Produces either am or pm.

H

Hour: 0-23.

For example:

  • H = 3 (one or two digits)
  • HH = 03 (always two digits)

k

Hour: 1-24.

For example:

  • k = 3 (one or two digits)
  • kk = 03 (always two digits)

K

Hour in am or pm: 0-11

h

Hour in am or pm: 1-12

m

Minute in an hour.

For example:

  • m = 8 (one or two digits)
  • mm = 08 (always two digits)

s

Second in a minute.

For example:

  • s = 5 (one or two digits)
  • ss = 05 (always two digits)

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:

PatternResult

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