You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Adal Gil Darias <ad...@avantic.net> on 2007/01/22 10:14:24 UTC
Between caluse with dates in a query
I need to do a query to the repository and ontain all nodes between two
dates but when i do the query doesn't get any result. but if only try to get
nodes after a date it works but not with both conditions.How can i do
that?Is it right with two conditions in same property?
The query I need is something like that:
/jcr:root/acs//element(*, nt:unstructured)[jcr:like(@tags, '%java%') and
(@date >= '2006-1-1T00:00:000Z') and (@date <= '2006-12-31T23:59:999Z') ]
order by @title descending
With one condition it works:
/jcr:root/acs//element(*, nt:unstructured)[jcr:like(@tags, '%java%') and
(@date <= '2006-12-31T23:59:999Z')] order by @title descending
Re: Between caluse with dates in a query
Posted by Marcel Reutegger <ma...@gmx.net>.
Hi,
you should indicate in the query that the value is a date:
use e.g. xs:dateTime('2006-12-31T23:59:59.999Z')
furthermore, both date strings are malformed it should rather read
'2006-01-01T00:00:00.000Z' and '2006-12-31T23:59:59.999Z'
regards
marcel
Adal Gil Darias wrote:
> I need to do a query to the repository and ontain all nodes between two
> dates but when i do the query doesn't get any result. but if only try to
> get
> nodes after a date it works but not with both conditions.How can i do
> that?Is it right with two conditions in same property?
> The query I need is something like that:
>
> /jcr:root/acs//element(*, nt:unstructured)[jcr:like(@tags, '%java%') and
> (@date >= '2006-1-1T00:00:000Z') and (@date <= '2006-12-31T23:59:999Z') ]
> order by @title descending
>
> With one condition it works:
>
> /jcr:root/acs//element(*, nt:unstructured)[jcr:like(@tags, '%java%') and
> (@date <= '2006-12-31T23:59:999Z')] order by @title descending
>