0

I have a process that updates documents in Solr with SolrNet, which are originanlly filled with data import from a Data Base.

I am having trouble with the DateTime formats because the documents indexed from the Data Base have datetimes like this

<str name="Date">2012-08-07 16:00:27.32</str>

and the documents indexed with solrnet have datetimes like this

<str name="Date">2012-08-14T15:57:30Z</str>

I need them to be like the first one, because when I read the document in c#, the date 2012-08-14T15:57:30Z is interpreted like 2012-08-14 12:57:30 and I don't know why.

Tanks!!!!!

Nicole
  • 1,356
  • 3
  • 21
  • 41
  • http://lucidworks.lucidimagination.com/display/lweug/Solr+Date+Format http://lucene.apache.org/solr/api-4_0_0-ALPHA/org/apache/solr/schema/DateField.html – Mauricio Scheffer Aug 14 '12 at 21:21

2 Answers2

1

I did a pretty ugly thing, but it did the job. I saved it as an string and applied

.ToString("yyyy-MM-dd HH:mm:ss.ff")

to it.

Thanks anyway!!

Nicole
  • 1,356
  • 3
  • 21
  • 41
0

The reason 2012-08-14T15:57:30Z converts to 2012-08-14 12:57:30 is due to the former format being UTC, which is +0. I assume you are running in a locale that is UTC-3, therefore when you convert the timestamp to your local DateTime, it appropriately deducts the 3hours for your time zone. It is inherently the same time though as 15:57 UTC+0 is 12:57 UTC-3.

dnolan
  • 2,349
  • 19
  • 21