Search This Blog

Tuesday 22 January 2013

Date Formatting in XML


Date Formatting

Date Formatting

XML Publisher supports three methods for specifying the date format:
·         Specify an explicit date format mask using Microsoft Word’s native date format mask.
·         Specify an explicit date format mask using Oracle’s format-date function.
·         Specify an abstract date format mask using Oracle’s abstract date format masks. (Recommended for multilingual templates.)
Only one method should be used. If both the Oracle and MS format masks are specified, the data will be formatted twice causing unexpected behavior.

Data Source Requirements

To use the Microsoft format mask or the Oracle format mask, the date from the XML data source must be in canonical format. This format is:
YYY-MM-DDThh:mm:ss+HH:MM
where
·         YYYY is the year
·         MM is the month
·         DD is the day
·         T is the separator between the date and time component
·         hh is the hour in 24-hour format
·         mm is the minutes
·         ss is the seconds
·         +HH:MM is the time zone offset from Universal Time (UTC), or Greenwich Mean Time
An example of this construction is:
2005-01-01T09:30:10-07:00
The data after the "T" is optional, therefore the following date: 2005-01-01 can be formatted using either date formatting option. Note that if you do not include the time zone offset, the time will be formatted to the UTC time.

Using the Microsoft Date Format Mask

Use the same procedure as number formatting.
Following table lists the supported Microsoft date format mask components:



No comments:

Post a Comment