Can I compare an element (type xs:date) to being greater than a variable? My query looks like this:
for $q in input()/PeriodControl
where $q/FromDate > ‘2001-01-01’
return $q
I have tried various ways of specifying the date, but haven’t yet hit on the right one.
If this is not possible, what type would you recommend we use for storing a date?
Have you tried:-
where $q/FromDate > xs:date(“2001-01-01”)
Thanks, Mike - works like a charm - I had to declare the namespace first. So my full XQuery is:
declare namespace xs=“XML Schema”
for $q in input()/PeriodControl
where $q/FromDate > xs:date(“2001-01-01”)
return $q