<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.parseDateTime.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.parseDateTime</api:function-name><api:suggest>xdmp.parsedatetime</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>parsedatetime</api:suggest><api:function-link mode="xquery" fullname="xdmp:parse-dateTime">/apidoc/8.0/xdmp:parse-dateTime.xml</api:function-link><api:function mode="javascript" name="parseDateTime" type="builtin" lib="xdmp" category="Extension" subcategory="Extension" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.parseDateTime"><api:summary>
   Parses a string containing date, time or dateTime using the supplied
   picture argument and returns a dateTime value.  While this function
   is closely related to other XSLT functions, it is available in XSLT
   as well as in all XQuery dialects and in Server-Side JavaScript.
 </api:summary><api:params><api:param name="picture" type="xs:string" optional="false"><api:param-description>
     The desired string representation of the given <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>.
     This follows the specification of
     <a href="http://www.w3.org/TR/xslt20/#processing-picture-string" target="_blank" xmlns="http://www.w3.org/1999/xhtml">picture string</a> in the W3C XSLT 2.0
     specification for the <code xmlns="http://www.w3.org/1999/xhtml">fn:format-dateTime</code> function.
     <pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">

   Symbol         Description
  -----------------------------------
     'Y'        year(absolute value)
     'M'        month in year
     'D'        day in month
     'd'        day in year
     'F'        day of week
     'W'        week in year
     'w'        week in month
     'H'        hour in day
     'h'        hour in half-day
     'P'        am/pm marker
     'm'        minute in hour
     's'        second in minute
     'f'        fractional seconds
     'Z'        timezone as a time offset from UTC
                for example PST
     'z'        timezone as an offset using GMT,
                for example GMT+1
</pre>
   </api:param-description><api:param-name>picture</api:param-name><api:param-type>String</api:param-type></api:param><api:param name="value" type="xs:string" optional="false"><api:param-description>
     The given string <code xmlns="http://www.w3.org/1999/xhtml">$value</code> representing the dateTime value
     that needs to be formatted.
   </api:param-description><api:param-name>value</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 language used in string representation of the date, time or
     dateTime value.
   </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>
     This argument is reserved for future use. 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 to take into account if there any country specific
     interpretation of the string while converting it into dateTime value.
   </api:param-description><api:param-name>country</api:param-name><api:param-type>String?</api:param-type></api:param></api:params><api:return>Date</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">The <code>xdmp:parse-dateTime</code> function will not parse all dates;
    if it does not parse a date, it can throw the
    <code>XDMP-PATTERNVALUEMISMATCH</code> exception.  To help normalize
    the dates so they can be parsed, you can try using the XSLT functions
    defined in the following stylesheet:</p>
    <p xmlns="http://www.w3.org/1999/xhtml"><pre>&lt;marklogic-dir&gt;/Modules/MarkLogic/appservices/utils/normalize-dates.xsl</pre></p>
    <p xmlns="http://www.w3.org/1999/xhtml">In particular xdmp:parse-dateTime does not support parsing names of days or months.</p>
 </api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
   xdmp.parseDateTime("[Y0001]-[M01]-[D01]T[h01]:[m01]:[s01].[f1][Z]",
		   "2014-01-06T17:13:50.873594-08:00")
   =&gt;
   2014-01-06T17:13:50.874-08:00
 </pre>
 </api:example></api:function></api:function-page>