ms:utc Function

Converts date/time related values into Coordinated Universal Time and into a fixed (normalized) representation that can be sorted and compared lexicographically.

          string ms:utc(string)

This function works only with time instances such as timeInstant, time, date, yearMonth, year, monthDay, day, and month. The utc() function does not work with periods of time such as timeDuration or its derived types. For nonstring arguments, this function acts as if a string function were first applied. This function does not depend on the presence of XSD information. If a string cannot be interpreted as a valid XSD date/time-related format, it returns an empty string. The rules for date/time values are:

  • A string is interpreted as a time-related XSD format and converted to the following format:




    Characters Represents


    A four digit year (for example, 2001).


    The number of a month (for example, 01 for January).


    A day of a month. Three digits are used to accommodate the ability to point out the exact day of the year (for example, in "2001-04-123", 123 points out the 123rd day of the year) .


    A two-digit hour (for example, "00-23").


    Seconds (for example, "00-59").


    Milliseconds (for example, "000-999"). If no milliseconds are specified, dashes representing milliseconds are right-truncated.

  • For negative time and years beyond 9999, the utc() function returns an empty string because negative timeInstances, periods, invalid Gregorian dates and other cases described in the following string constraints section will not be able to compare correctly.

  • Fields indicating recurrence are replaced with the same number of "-" characters.

  • Unspecified fields are replaced with "-" characters.

String Comparison Constraints:

  • Lexicographical comparison does not work for sets of mixed AC and BC dates, and gives a reverse order for BC dates. Lexicographical comparison does not work for years greater than 9999.

Build Date: