This module provides functions to retrieve the current dateTime and to parse dates and times.
In contrast to the current-dateTime functions specified in XQuery Functions and Operators, the functions in this module are nondeterministic, that is, they do not return the current dateTime from the dynamic context, but return the actual value.
Dates and times are parsed according to the format given by strptime.
However, date and time values must be "complete."
For a date, the year and either month and day or day of the year must have been parsed.
For a time, the hour must have been parsed. (If either the minute, second, or timezone has not been parsed, they default to 0.)
For a dateTime, the parsing requirements of both date and time must be met.
When a locale is given, it must be of the form {lang}[{sep}{country}[{encoding}]] where {lang} is an ISO 639-1 2-letter or 639-2 3-letter language code, {sep} is either '-' or '_', {country} is an ISO 3166-1 2-letter country code, and {encoding} is any string that begins with a '.'.
The {sep}, {country}, and {encoding} are optional; {encoding} is always ignored.
Examples include: de, en-US, fr_CA, ru_RU.UTF-8.
current-date
() as xs:date external
Gets the current date value in Universal time. |
current-dateTime
() as xs:dateTimeStamp external
Gets the current dateTime value in Universal time. |
current-time
() as xs:time external
Return the current time value in Universal time. |
millis-to-dateTime
($millis as xs:long) as xs:dateTime external
Converts the given number of milliseconds since epoch into its corresponding xs:dateTime. |
parse-date
($input as xs:string, $format as xs:string) as xs:date external
Parses a date from a string in the current locale. |
parse-date
($input as xs:string, $format as xs:string, $locale as xs:string) as xs:date external
Parses a date from a string in the given locale. |
parse-dateTime
($input as xs:string, $format as xs:string) as xs:dateTime external
Parses a dateTime from a string in the current locale. |
parse-dateTime
($input as xs:string, $format as xs:string, $locale as xs:string) as xs:dateTime external
Parses a dateTime from a string in the given locale. |
parse-time
($input as xs:string, $format as xs:string) as xs:time external
Parses a time from a string in the current locale. |
parse-time
($input as xs:string, $format as xs:string, $locale as xs:string) as xs:time external
Parses a time from a string in the given locale. |
timestamp
() as xs:long external
Gets the the number of milliseconds since epoch. |
utc-offset
() as xs:long external
Gets the offset of the current timezone from Universal time. |
declare %an:nondeterministic function datetime:current-date() as xs:date external
Gets the current date value in Universal time.
Note that this function is not stable: it returns the value of the date when the function is invoked.
declare %an:nondeterministic function datetime:current-dateTime() as xs:dateTimeStamp external
Gets the current dateTime value in Universal time.
Note that this function is not stable: it returns the value of the date and time when the function is invoked.
declare %an:nondeterministic function datetime:current-time() as xs:time external
Return the current time value in Universal time.
Note that this function is not stable: it returns the value of the time when the function is invoked.
declare function datetime:millis-to-dateTime($millis as xs:long) as xs:dateTime external
Converts the given number of milliseconds since epoch into its corresponding xs:dateTime.
declare function datetime:parse-date($input as xs:string, $format as xs:string) as xs:date external
Parses a date from a string in the current locale.
declare function datetime:parse-date($input as xs:string, $format as xs:string, $locale as xs:string) as xs:date external
Parses a date from a string in the given locale.
declare function datetime:parse-dateTime($input as xs:string, $format as xs:string) as xs:dateTime external
Parses a dateTime from a string in the current locale.
declare function datetime:parse-dateTime($input as xs:string, $format as xs:string, $locale as xs:string) as xs:dateTime external
Parses a dateTime from a string in the given locale.
declare function datetime:parse-time($input as xs:string, $format as xs:string) as xs:time external
Parses a time from a string in the current locale.
declare function datetime:parse-time($input as xs:string, $format as xs:string, $locale as xs:string) as xs:time external
Parses a time from a string in the given locale.
declare %an:nondeterministic function datetime:timestamp() as xs:long external
Gets the the number of milliseconds since epoch.
declare %an:nondeterministic function datetime:utc-offset() as xs:long external
Gets the offset of the current timezone from Universal time.