[MarkLogic Dev General] Comparing Dates

Jonathan Cook jonathan.cook2 at bbc.co.uk
Thu Mar 8 08:58:50 PST 2012


I wondered what the best way to compare dates using mark logic xquery was?

My query looks like this at the moment:

import module namespace xinc = "http://marklogic.com/xinclude" at

let $asset_type_code := "STY"
let $asset_creation_date := "20111017"

let $results := /*[
    /*/itemMeta/assetTypeCode[text()=$asset_type_code] and

return $results

However what I would like to do is use the $asset_creation_date variable
which would be of format yyyyMMdd and see if it equals the first part of the
firstCreated element which is in a different format as above? There doesn¹t
seem to be many date time functions and also I¹m not sure if I¹m going about
this slightly the wrong way or if I would have to do it in a second FLOWR
statement using some string comparison?


This e-mail (and any attachments) is confidential and may contain personal views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120308/2aacfbc5/attachment.html 

More information about the General mailing list