Skip to main content

Date and Time Format Switch

  • 2 minutes to read

Syntax

@ [ “ ] switch-argument [ “ ]

A date-and-time format switch specifies the format of a date or time result.

Specifiers

Use “M” for the month, “d” for the Day. For the year, use “yy” or “yyyy”. For the Hours, use “h” or “hh” for the hour, “m” or “mm” for the minute, and “am/pm” to include the AM/PM designation. To include other text inside the result, enclose it in single quote marks.

You can combine the following specifiers to construct a format string.

Specifier Description
d Displays the day as a number without a leading zero for single-digit days.
dd Displays the day as a number with a leading zero for single-digit days.
ddd Displays the day of the week in its abbreviated form according to the current culture.
dddd Displays the full name of the day of the week according to the current culture.
M Displays the month as a number without a leading zero for single-digit months.
MM Displays the month as a number with a leading zero for single-digit months.
MMM Displays the month in its abbreviated form according to the current culture.
MMMM Displays the full name of the month according to the current culture.
yy Displays the year number as two digits with a leading zero for years 0 - 9.
yyyy Displays the year number as four digits
h or H Displays the hour as a number without a leading zero for single-digit hours.
hh or HH Displays the hour as a number with a leading zero for single-digit hours.
m Displays the minutes as a number without a leading zero for single-digit minutes.
mm Displays the minutes as a number with a leading zero for single-digit minutes.
am/pm or AM/PM Displays time using am/pm or AM/PM notation.
ss Displays the seconds as a number with a leading zero for single-digit seconds.

Examples

  • Field code {DATE @ “‘Today is ‘MMM. d, yyyy”} results in Today is Dec. 29, 2011
  • Field code {DATE @ “‘Current time is ‘HH:mm:ss”} results in Current time is 17:13:15