Ok, so my date input below is "May 28, 2015", but my script below says my 
pattern doesn't match. I think it should but according to the comment in 
https://docs.marklogic.com/xdmp:parse-dateTime, as of 6.0-3.1 this function 
does not round-trip non-numeric values. For example 
format-dateTime(current-dateTime(), '[MN]') => JUNE but 
xdmp:parse-dateTime('[MN]', 'JUNE') throws XDMP-PATTERNVALUEMISMATCH.

I need to convert a date like "May 28, 2015" to something like 2015-05-28 so 
that I can use it to compare dates as a part of a query.  What am I missing?  
Here's a scriptlet that illustrates the issue.



xquery version "1.0-ml";
declare namespace html = "http://www.w3.org/1999/xhtml";;
declare namespace local="this";

declare function local:convert-date($startdateTime as xs:string) as node()*{
                                fn:format-dateTime((xdmp:parse-dateTime("[MNn] 
[D1], [Y0001]",
                                                                  xs:string( 
$startdateTime ) )),
                                                                  
"[Y0001]-[M01]-[D01]" )
};

declare variable $startdateTime as xs:string external;

let $startdateTime:="May 28, 2015"

(:
return $startdateTime
:)

let $this-start-date:= local:convert-date($startdateTime)

  return $this-start-date






_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to