Hi,
On 5/15/07, hsp_ <[EMAIL PROTECTED]> wrote:
I need to do a search that compare the value in a date propertie adding a
constant to this propertie, something like this:
//element(*,nt:base)[ (@prop:date + xs:dateTime('"+dateContant+"') ) <
xs:dateTime('"+today+"')]";
My dificult is on: (@prop:date + xs:dateTime('"+dateContant+"') )
because the comparison ' < xs:dateTime('"+today+"') ' is ok for only a
propertie.
Would my query be possible?
How about an approach like the following:
// Calculate the query date, in this case three days before today
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -3);
// Format the date as an ISO 8601 string (ValueFactory is our friend!)
ValueFactory factory = session.getValueFactory();
String iso8601 = factory.createValue(calendar).getString();
// Generate the query string (//* is equivalent to //element(*,nt:base))
String query = "//[EMAIL PROTECTED]:date < xs:dateTime(" + iso8601 + ")]";
BR,
Jukka Zitting