MarkLogic Server 11.0 Product Documentation
fn.formatDate

fn.formatDate(
   value as Date,
   picture as String,
   [language as String],
   [calendar as String],
   [country as String]
) as String

Summary

Returns a formatted date 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 date $value that needs to be formatted.
picture The desired string representation of the given date $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 date $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

Dates before October 15, 1582 (the start of the Gregorian calendar) will not return the correct date value.

Example

   fn.formatDate(fn.currentDate(),
                 "[Y01]/[M01]/[D01]")
   =>
   14/12/05

   fn.formatDate(fn.currentDate(),
                 "[Y0001]/[M01]/[D01]","en","AD","US")
   =>
   2014/12/05
 
Powered by MarkLogic Server | Terms of Use | Privacy Policy