Custom Date/Time format strings

The date/time format string specifies how a date and/or time should be formatted when displayed. Some of these formats are not available on all devices.

The following elements are supported in date/time format strings.

Format variable Description
d Displays the day of the month (1 – 31). If the day can be expressed as a single digit number, then it will be formatted with one digit.
dd Displays the day of the month (01 – 31) as a two-digit number. Single digit days will have a leading zero added.
EEE Displays the abbreviated name of the day of the week (for example “Sat,” “Mon”). This is a calculated field based upon the values entered by the user at the control panel.
EEEE Displays the full name of the day of the week (for example “Saturday,” “Monday”). This is a calculated field based upon the values entered by the user at the control panel.
M Displays the month (1 – 12). If the month can be expressed as a single digit number, then it will be formatted with one digit.
MM Displays the month (01 – 12) as a two-digit number. Single digit months will have a leading zero added.
MMM Displays the abbreviated name of the month (for example “Jan,” “Feb”).
MMMM Displays the full name of the month (for example “January,” “February”).
yy Displays the last two digits of the year.
yyyy Displays all four digits of the year.
h Displays the hour of the time (1 – 12). If the hour can be expressed as a single digit number, then it will be formatted with one digit. This is for clocks based on twelve-hour time.
hh Displays the hour of the time (01 – 12) as a two-digit number. Single digit numbers will have a leading zero added. This is for clocks based on twelve-hour time.
HH Displays the hour of the time (00 – 23) as a two-digit number. Single digit numbers will have a leading zero added. This is for twenty-four hour time.
mm Displays the minutes of the time (00 – 59) as a two-digit number. Single digit numbers will have a leading zero added
a Displays the A.M/P.M. designator for the time.

All other alphabetic characters are invalid. Symbols and numeric characters, however, are untouched.  Here are a few examples:

  • “EEEE, MMMM dd, yyyy” is “Monday, January 03, 2009”
  • “yyyy-MM-dd HH:mm” is “2009-01-03 15:35”
  • “hh:mm a” is “3:35 P.M.”