Aracılığıyla paylaş


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)

Remarks

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:

    YYYY-MM-DD T HH:NN:SS.III

    where

    Characters Represents

    YYYY

    A four digit year (for example, 2001).

    MM

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

    DDD

    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) .

    HH

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

    SS

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

    III

    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.

See Also

Reference

XML Schemas (XSD) Reference
XML Data Types Reference