[XQZone General] convert date into marklogic date

Jason Hunter jhunter at marklogic.com
Wed Jul 13 12:02:47 PDT 2005


Well here's one way to write it:

max(
  for $i in //date-time
  return xs:dateTime($i)
)

Depending on the size of your data this could get slow.  You can use the 
admin screens to add a "range index" for the <data-time> element, 
assigning the type of xs:dateTime to the range index, and then you'll 
get fast less than and greater than operations which can be used to trim 
down the data before doing the max.

Note that because of how the dateTimes are serialized, max() of the 
string values does solve the problem there so long as the time zones are 
uniform.

-jh-

Nizamuddin, Rashid wrote:

> I got a new problem now
> I have the dates entered into my xml document as 
>   <date-time>2005-07-12T18:14:21.236-07:00</date-time> 
>   <date-time>2005-07-12T18:14:30.971-07:00</date-time>
> 
> These are in string format. I need to get the max of the date among the
> two.
> I don't think so the max function works here since both of them are
> stored a strings. Is there a way I can convert this into date and then
> run the max function?
> Any help...
> 
> Rashid
> 
> _______________________________________________
> General mailing list
> General at xqzone.marklogic.com
> http://xqzone.com/mailman/listinfo/general
> 



More information about the General mailing list