title: How to compare Dates in MarkLogic?
body: <p>I am having below XML in $doc variable</p>
  
  <pre><code> let $doc := &lt;root&gt;
                &lt;date&gt;12/31/2016&lt;/date&gt;
               &lt;/root&gt;
  </code></pre>
  
  <p>I want to take this date and compare it with Today's date. It should return me True but it is returning me false.</p>
  
  <p>I am using the below code-</p>
  
  <pre><code>let $doc := &lt;root&gt;
                &lt;date&gt;12/31/2016&lt;/date&gt;
               &lt;/root&gt;
  
  
  let $date := $doc/date/text()
  let $today :=fn:format-date(fn:current-date(),"[M01]/[D01]/[Y0001]")
  return $date le $today
  </code></pre>
  
  <p>any suggestions ?</p>