jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Zitting" <jukka.zitt...@gmail.com>
Subject Re: Comparing by time
Date Thu, 13 Nov 2008 13:09:12 GMT
Hi,

On Thu, Nov 13, 2008 at 1:22 AM, pkrishna <prabhakar.krishnaswami@ge.com> wrote:
> I am trying to do a search based on Modified time. What I am observing is the
> time format in the node is different from when I am using a
> SimpleDateFormat; For example, in the node the lastModified time is saved as
> 2008-11-12T16:46:57.089-07:00. I used SimpleDateFormat using the pattern
> yyyy-MM-dd'T'HH:mm:ss.SSSZ which seems to be the closest to the format of
> the time in the node. I observed for the same date, the call
> SimpleDateFormat.format produces a string which ends with -700 which is
> slightly different from -07:00. So my question is how I incorporate into a
> query that does an exact match on the date. Is this even possible?

The easiest way to format dates using the exact format specified in
JSR-170 is to use the following code:

    Calendar date = ...;
    session.getValueFactory().getValue(date).getString();

Similarly, you can parse JSR-170 date values like this:

    String date = ...;
    session.getValueFactory().getValue(date).getDate();

BR,

Jukka Zitting

Mime
View raw message