<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/fn.formatDateTime.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>fn.formatDateTime</api:function-name><api:suggest>fn.formatdatetime</api:suggest><api:suggest>fn</api:suggest><api:suggest>formatdatetime</api:suggest><api:function-link mode="xquery" fullname="fn:format-dateTime">/apidoc/8.0/fn:format-dateTime.xml</api:function-link><api:function mode="javascript" name="formatDateTime" type="builtin" lib="fn" category="DurationDateTimeBuiltins" bucket="W3C-Standard Functions" hidden="false" prefix="fn" namespace="http://www.w3.org/2005/xpath-functions" fullname="fn.formatDateTime"><api:summary>
   Returns a formatted dateTime 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.
 </api:summary><api:params><api:param name="value" type="xs:dateTime" optional="false"><api:param-description>
     The given dateTime <code xmlns="http://www.w3.org/1999/xhtml">$value</code> that needs to be formatted.
   </api:param-description><api:param-name>value</api:param-name><api:param-type>Date</api:param-type></api:param><api:param name="picture" type="xs:string" optional="false"><api:param-description>
     The desired string representation of the given dateTime
     <code xmlns="http://www.w3.org/1999/xhtml">$value</code>.
          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
     <a href="http://www.w3.org/TR/xslt20/#date-picture-string" target="_blank" xmlns="http://www.w3.org/1999/xhtml">http://www.w3.org/TR/xslt20/#date-picture-string</a>.
   </api:param-description><api:param-name>picture</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="language" type="xs:string" optional="true"><api:param-description>
     The desired language for string representation of the dateTime
     <code xmlns="http://www.w3.org/1999/xhtml">$value</code>.
   </api:param-description><api:param-name>language</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="calendar" type="xs:string" optional="true"><api:param-description>
     The only calendar supported at this point is "Gregorian" or "AD".
   </api:param-description><api:param-name>calendar</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="country" type="xs:string" optional="true"><api:param-description>
     $country is used the specification to take into account country specific
     string representation.
   </api:param-description><api:param-name>country</api:param-name><api:param-type>String</api:param-type></api:param></api:params><api:return>String</api:return><api:usage>
    <p xmlns="http://www.w3.org/1999/xhtml">Dates before October 15, 1582 (the start of the Gregorian calendar) will
    not return the correct dateTime value.</p>
    <p xmlns="http://www.w3.org/1999/xhtml">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.</p>
 </api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
   fn.formatDateTime(fn.currentDateTime(),
                 "[Y01]/[M01]/[D01] [H01]:[m01]:[s01]:[f01]")
   =&gt;
   14/12/05 10:37:25:63

  fn.formatDateTime(fn.currentDateTime(),
                 "[Y0001]/[M01]/[D01] [H01]:[m01]:[s01]:[f01]","en","AD","US")
   =&gt;
   2014/12/05 10:40:02:16
 </pre>
 </api:example></api:function></api:function-page>