Formatting Dates
A date in an XML document is saved in the format specific to the datatype of its node. For example, the value of an xs:date node will have the format YYYY-MM-DD[±HH:MM], while the value of an xs:dateTime node will have the format YYYY-MM-DDTHH:MM:SS[±HH:MM]. These formats are said to be the lexical representations of that data. By default, it is the lexical representation of the data that is displayed in Authentic View and the output. However, in the SPS, the Value Formatting feature can be used to display dates in alternative formats in Authentic View and, in some cases, optionally in the output.
Value Formatting for dates can be used to define custom formats for nodes and Auto-Calculations of the following datatypes:
•xs:date
•xs:dateTime
•xs:duration
•xs:gYear
•xs:gYearMonth
•xs:gMonth
•xs:gMonthDay
•xs:gDay
Using Value Formatting to format date nodes
To format dates alternatively to the lexical format of the date node, do the following:
1.Select the contents placeholder or input field of the node. Note that value formatting can only be applied to nodes created as contents or an input field.
2.In the Properties sidebar, select the autocalc item, and then the AutioCalc group of properties. Now click the Edit button of the Value Formatting property. This displays the Value Formatting dialog (screenshot below).
By default, the Unformatted radio button (the standard lexical format for the node's datatype) is selected.
3. | To define an alternative format, select the Format radio button. |
4. | You can now select a predefined date format from the drop-down list of the combo box (screenshot below), or define your own format in the input field of the combo box. See Value Formatting Syntax for details about the syntax to use when defining your own format. |
Using Value Formatting to format Auto-Calculations
When Auto-Calculations evaluate to a value that is a lexical date format, Value Formatting can be used to format the display of the result. Do this as follows:
1.Select the Auto-Calculation in the design.
2.In the Properties sidebar, select the content item, and then the AutoCalc group of properties. Now click the Edit button of the Value Formatting property. This pops up the Value Formatting dialog (screenshot below).
By default, the Unformatted radio button is selected.
3. | To define an alternative format, select the Format radio button. |
4. | In the Options for XML Schema value pane, in the Datatype combo box, select the date datatype to which the Auto-Calculation will evaluate. In the Format combo box, you can then select a predefined date format from the drop-down list (available options depend on the selected datatype), or define your own format in the input field of the combo box. See Value Formatting Syntax for details about the syntax to use when defining your own format. |
Applying Value Formatting to the output
The Value Formatting that you define applies to Authentic View. Additionally, some Value Formatting definitions—not all—can also be applied to HTML output. To do this, check the Apply Same Format to XSLT Output check box. If this option is not checked or if it is not available, then only Authentic View will display the Value Formatting; the output will display the value in its lexical format (for nodes) or, in the case of Auto-Calculations, in the format to which the Auto-Calculation evaluates.