DateFormat class

Office 2013 and later

Date Display Mask. When the object is serialized out as xml, its qualified name is w:dateFormat.

Namespace:  DocumentFormat.OpenXml.Wordprocessing
Assembly:  DocumentFormat.OpenXml (in DocumentFormat.OpenXml.dll)

public class DateFormat : StringType

[ISO/IEC 29500-1 1st Edition]

dateFormat (Date Display Mask)

The element specifies the display format which shall be used to format any date entered into the parent structured document tag in full DateTime format [Example: Through a user interface (a date picker), or through custom XML data associated with this structured document tag via the dataBinding element (§ end example] before displaying it in the structured document tag's run content.

If this element is omitted, then the date shall be formatted using the standard date display mask for the language ID specified on the lid element (§ if present, or the language ID of the run contents otherwise.

The date display mask specified in the val attribute shall be interpreted using the semantics specified in §

[Example: Consider the following structured document tag properties:

  <w:date w:fullDate="2006-01-01T06:30:00Z">
    <w:dateFormat w:val="MM-YYYY"/>

The full XML Schema DateTime format for the current structured document tag is specified via the fullDate attribute value as 2006-01-01T06:30:00Z, and the date display mask is MM-YYYY, therefore the resulting date displayed in the document must be 01-2006 (the month and long year from the full date value, respectively). end example]

Parent Elements

date (§



val (String Value)

Specifies that its contents contain a string.

The contents of this string are interpreted based on the context of the parent XML element.

[Example: Consider the following WordprocessingML fragment:

  <w:pStyle w:val="heading1" /> 

The value of the val attribute is the ID of the associated paragraph style's styleId.

However, consider the following fragment:

  <w:alias w:val="SDT Title Example" />

In this case, the decimal number in the val attribute is the caption of the parent structured document tag. In each case, the value is interpreted in the context of the parent element. end example]

The possible values for this attribute are defined by the ST_String simple type (§

[Note: The W3C XML Schema definition of this element’s content model (CT_String) is located in §A.1. end note]

© ISO/IEC29500: 2008.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.