Date and time formatting

date-and-time-formatting-switch:\@ [ " ] switch-argument [ " ]

A date-and-time-formatting-switch specifies the format of a date or time result.
Note: : This switch is sometimes called a picture switch because it allows the use of symbols to represent the format of the field result.
If the result of a field is not a date or time, this switch has no effect.

Quotation marks are required around switch-argument if it contains white space; otherwise, they are optional.

If no date-and-time-formatting-switch is present, a date or time result is formatted in an implementation-defined manner.

A date and time switch-argument is made up of a series of picture items.

Date and Time Formatting Picture Items

Picture Item

Description

d

Formats the day of( the week or day of the month as a number without a leading 0 for single-digit days.

dd

Formats the day of the week or day of the month as a number with a leading 0 for single-digit days.

ddd

Formats the day of the week or month in its abbreviated form according to the language specified by the <lang> element (§2.3.2.18) on the run containing the field instructions.

dddd

Formats the day of the week as its full name according to the language specified by the <lang> element (§2.3.2.18) on the run containing the field instructions.

M

Formats the month as a number without a leading 0 for single-digit months.

MM

Formats the month as a number with a leading 0 for single-digit months.

MMM

Formats the month in its abbreviated form according to the language specified by the <lang> element (§2.3.2.18) on the run containing the field instructions.

MMMM

Formats the month as its full name according to the language specified by the <lang> element (§2.3.2.18) on the run containing the field instructions.

yy

Formats the year as two digits with a leading 0 for years 0–9.

yyyy

Formats the year as four digits.

In the following time formats, a lowercase h indicates that time is based on a 12-hour clock, while uppercase H indicates time is based on a 24-hour clock.

mk:@MSITStore:d://MOffice//OFFICE11//1033//wdmain11.chm::/html/worefDateTimePicture1.htm

Time Formatting Picture Items

Picture Item

Description

h or H

Formats the hour without a leading 0 for single-digit hours.

hh or HH

Formats the hour with a leading 0 for single-digit hours.

m

Formats the minutes without a leading 0 for single-digit minutes.

mm

Formats the minutes with a leading 0 for single-digit minutes.

am/pm or AM/PM

Formats using an am/AM or pm/PM suffix.

Miscellaneous Formatting Picture Items

Picture Item

Description

Other character

Includes the specified character in the result at that position.
Note: : Commonly used characters are colon (:), hyphen (-), asterisk (*), slash (/), and space.

'text'

Includes text in the result.

`numbered-item`

Includes, in Arabic numerals, the number of the preceding item numbered as a caption or resulting from a SEQ field (§2.16.5.63). numbered-item shall be the same name as identifier in that SEQ field.

example:

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 \@ "MMM-yy"

Jan-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:ss am/pm"

5:28:34 PM

DATE \@ "HH:mm"

17:28

DATE \@ "'Today is 'HH:mm:ss"

Today is 17:28:34