Loading TOC...

MarkLogic 12 EA 1 Product Documentation
fn:format-time

fn:format-time(
   $value as xs:time,
   $picture as xs:string,
   [$language as xs:string],
   [$calendar as xs:string],
   [$country as xs:string]
) as xs:string

Summary

Returns a formatted time value based on the picture argument. This is an XSLT function, and it is available in XSLT, XQuery 1.0-ml, and Server-Side JavaScript.

Parameters
value The given time $value that needs to be formatted.
picture The desired string representation of the given time $value. The picture string is a sequence of characters, in which the characters represent variables such as, decimal-separator-sign, grouping-sign, zero-digit-sign, digit-sign, pattern-separator, percent sign and per-mille-sign. For details on the picture string, see http://www.w3.org/TR/xslt20/#date-picture-string.
language The desired language for string representation of the time $value.
calendar The only calendar supported at this point is "Gregorian" or "AD".
country $country is used the specification to take into account country specific string representation.

Usage Notes

If the specified picture string includes a fractional second width that is seven or more decimal places, then the fractional seconds are truncated (not rounded) on the seventh and greater width.

Example

   fn:format-time(fn:current-time(),
                 "[H01]:[m01]:[s01]:[f01]")
   =>
   10:52:09:00

   fn:format-time(fn:current-time(),
                 "[H01]:[m01]:[s01]:[f01]","en","AD","US")
   =>
   10:52:33:00
 

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.