Ah, great! I knew the problem was between the keyboard and the chair. Thanks!

-----Original Message-----
From: Sethi, Parampreet [mailto:parampreet.se...@teamaol.com]
Sent: Wednesday, August 10, 2011 10:25 AM
To: solr-user@lucene.apache.org
Subject: Re: Dates off by 1 day?


The Date difference is coming because of different time zones.

In Solr the date is stored as Zulu time zone and Solrj is returning date in
CDT timezone (jvm is picking system time zone.)

>         <date name="FILE_DATE">2002-05-13T00:00:00Z</date>

> I get:
>
>         --> Sun May 12 19:00:00 CDT 2002

You can convert Date in different time-zones using Java Util date functions
if required.

Hope it helps!

-param
On 8/10/11 11:20 AM, "Olson, Ron" <rol...@lbpc.com> wrote:

> Hi all-
>
> I apologize in advance if this turns out to be a problem between the keyboard
> and the chair, but I'm confused about why my date field is correct in the
> index, but wrong in SolrJ.
>
> I have a field defined as a date in the index:
>
>         <field name="FILE_DATE" type="date" indexed="true" stored="true"/>
>
> And if I use the admin site to query the data, I get the right date:
>
>         <date name="FILE_DATE">2002-05-13T00:00:00Z</date>
>
> But in my SolrJ code:
>
>         Iterator<SolrDocument> iter = queryResponse.getResults().iterator();
>
>         while (iter.hasNext())
>         {
>             SolrDocument resultDoc = iter.next();
>
>             System.out.println("--> " + resultDoc.getFieldValue("FILE_DATE"));
>
>         }
>
> I get:
>
>         --> Sun May 12 19:00:00 CDT 2002
>
> I've been searching around through the wiki and other places, but can't seem
> to find anything that either mentions this problem or talks about date
> handling in Solr/SolrJ that might refer to something like this.
>
> Thanks for any info,
>
> Ron
>
>
>
> DISCLAIMER: This electronic message, including any attachments, files or
> documents, is intended only for the addressee and may contain CONFIDENTIAL,
> PROPRIETARY or LEGALLY PRIVILEGED information.  If you are not the intended
> recipient, you are hereby notified that any use, disclosure, copying or
> distribution of this message or any of the information included in or with it
> is  unauthorized and strictly prohibited.  If you have received this message
> in error, please notify the sender immediately by reply e-mail and permanently
> delete and destroy this message and its attachments, along with any copies
> thereof. This message does not create any contractual obligation on behalf of
> the sender or Law Bulletin Publishing Company.
> Thank you.



DISCLAIMER: This electronic message, including any attachments, files or 
documents, is intended only for the addressee and may contain CONFIDENTIAL, 
PROPRIETARY or LEGALLY PRIVILEGED information.  If you are not the intended 
recipient, you are hereby notified that any use, disclosure, copying or 
distribution of this message or any of the information included in or with it 
is  unauthorized and strictly prohibited.  If you have received this message in 
error, please notify the sender immediately by reply e-mail and permanently 
delete and destroy this message and its attachments, along with any copies 
thereof. This message does not create any contractual obligation on behalf of 
the sender or Law Bulletin Publishing Company.
Thank you.

Reply via email to