Hi Hari, Easiest way is to use the standard ISO dateTime format and add a "range index" on the QName. Then you can use cts:element-range-query() to quickly search ranges of dates, or cts:element-values() or cts:element-value-ranges() to get analytics. The ISO dates are time zone aware, though time zones are hairy business. Make sure on your range index you specify the data type.
Use current-dateTime() to get a sample of what an xs:dateTime looks like. -jh- On Dec 16, 2010, at 5:19 PM, Hari Krishna Dara wrote: > I am new to MarkLogic and XQuery and wondering how to store date and time > such that it can be easily searched against. E.g., I would like to find all > the documents with a datetime that is less than a given value. I noticed that > XPath has xs:dateTime() constructor given a date and a time, so are we > supposed to split the datetime into date and time parts and store as two > elements? What about timezone information? Is it better to convert to > something like GMT and ignore it altogether in the query? > > Thank you, > Hari > _______________________________________________ > General mailing list > [email protected] > http://developer.marklogic.com/mailman/listinfo/general _______________________________________________ General mailing list [email protected] http://developer.marklogic.com/mailman/listinfo/general
