bikedorkseattle
bikedorkseattle

Reputation: 981

Solr date field format

I'm a little confused on the proper format for the solr date fieldtype. When importing from a mySQL database does it need to be in this format?

1995-12-31T23:59:59Z

In my database the date and time fields are in different columns. Right now my query looks like this.

SELECT eb.eventID, concat(CAST(e.startDate AS CHAR),'T ',CAST(e.startTime as CHAR),'Z')

Am I on the right track?

Upvotes: 6

Views: 16233

Answers (1)

David Faber
David Faber

Reputation: 12485

Yes, it does need to be in that format if you use the Solr "DateField" type: http://lucene.apache.org/solr/api/org/apache/solr/schema/DateField.html

I don't know the proper way to format dates in MySQL but you do want to make sure that the date is in the format yyyy-mm-dd and the time in the format HH:mi:ss.

Upvotes: 8

Related Questions