Skip to main content

Wordprocessing Fields

Date and Time Field Formatting

Date and time field formatting switches have the following format:

\@ *switch argument*

A date and time field switch argument is made up of a series of "picture items." The most commonly used are below.

Reference: ECMA-376, 3rd Edition (June, 2011), Fundamentals and Markup Language Reference § 17.16.4.1.

Date and Time Field Switch Picture Items:​

Picture ItemDescription
dFormats the day of the week or day of the month as a number without a leading zero for single-digit days.
ddFormats the day of the month as a two-digit number with a leading zero for single-digit days.
dddFormats the day of the week in its abbreviated form according to the language specified by the lang element on the run containing the field instructions.
ddddFormats the day of the week as its full name according to the language specified by the lang element on the run containing the field instructions.
MFormats the month as a number without a leading zero for single-digit months.
MMFormats the month as a number with a leading zero for single-digit months.
MMMFormats the month in its abbreviated form according to the language specified by the lang element on the run containing the field instructions.
MMMMFormats the month as its full name according to the language specified by the lang element on the run containing the field instructions.
WFormats the day of the week in an abbreviated form according to the language specified by the lang element on the run containing the field instructions.
yyFormats the year as a 2-digit number.
yyyyFormats the year as a 4-digit number.
hor HFormats the hour on a 12-hour clock without a leading zero for single-digit hours.
hhFormats the hour on a 12-hour clock with a leading zero for single-digit hours.
HFormats the hour on a 24-hour clock without a leading zero for single-digit hours.
HHFormats the hour on a 24-hour clock with a leading zero for single-digit hours.
mFormats the minutes without a leading zero for single-digit minutes.
mmFormats the minutes with a leading zero for single-digit minutes.
sFormats the seconds without a leading zero for single-digit minutes.
ssFormats the minutes as a two-digit number with a leading zero for single-digit seconds.
am/pm or AM/PMFormats the uppercase 12-hour clock indicators according to the language specified by the lang element on the run containing the field instructions.
Other characterIncludes the specified character in the result at that position. E.g., colon (:), hyphen (-), slash (/), and space.
'text'Includes text in the result.

Below are some examples of date and time for US-English.

Date and Time Switch Examples:​

SwitchResult
DATE @ "M/d/yyyy"1/3/2006
DATE @ "dddd, MMMM dd, yyyy"Tuesday, January 03, 2006
DATE @ "MMMM d, yyyy"January 3, 2006
DATE @ "M/d/yy"1/3/06
DATE @ "yyyy-MM-dd"2006-01-03
DATE @ "d-MMM-yy"3-Jan-06
DATE @ "M.d.yyyy"1.3.2006
DATE @ "MMM. d, yy"Jan. 3, 06
DATE @ "d MMMM yyyy"3 January 2006
DATE @ "MMMM yy"January 06
DATE @ "M/d/yyyy h:mm am/pm"1/3/2006 5:28 PM
DATE @ "M/d/yyyy h:mm:ss am/pm"1/3/2006 5:28:34 PM
DATE @ "h:mm am/pm"5:28 PM
DATE @ "h:mm am/pm"5:28:34 PM
DATE @ "HH:mm"17:28
DATE @ "'Today is 'HH:mm:ss"Today is 17:28:34