Skip To Content

Format dates

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:

CharacterDescription

y

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

See the following example:

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

M

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

See the following 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.

See the following example:

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

E

Day of the week.

See the following 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 a.m. or p.m.

H

Hour: 0–23.

See the following example:

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

k

Hour: 1–24.

See the following example:

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

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:

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

s

Second in a minute.

See the following example:

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

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:

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