Solr stores dates in UTC. There is no timezone conversion or other date-format processing in Solr. The admin screen only shows in UTC.
------ I want to get local time(JST) on Solr Admin. On Wed, Oct 6, 2010 at 9:14 AM, Gora Mohanty <g...@mimirtech.com> wrote: > On Wed, Oct 6, 2010 at 9:17 PM, Kouta Osabe <kota0919was...@gmail.com> wrote: >> Hi, Gora >> >> Thanks for your advice. >> >> and then I try to write these codes following your advice. >> >> Case1 >> "pub_date" column(MySQL) is 2010-09-27 00:00:00. >> >> I wrote like below. >> >> SolrJDto info = new SolrJDto(); >> TimeZone tz2 = TimeZone.getTimeZone("UTC+9"); >> Calendar cal = Calendar.getInstance(tz2); >> // publishDate represent "publish_date" column on Solr Schema and the >> type is "pdate". >> info.publishDate = rs.getDate("publish_date",cal); >> >> then I got "2010-09-27T00:00:00Z" on Solr Admin. >> This result is what I expected. >> >> Case2 >> "reg_date" column(MySQL) is 2010-09-27 11:22:33. >> >> I wrote like below. >> TimeZone tz2 = TimeZone.getTimeZone("UTC+9"); >> Calendar cal = Calendar.getInstance(tz2); >> info.publishDate = rs.getDate("reg_date",cal); >> >> then, I got "2010-09-27T02:22:33Z" on Solr admin. >> this result is not what i expected. > [...] > > It seems like mysql is doing UTC conversion for one column, > and not for the other. I can think of two possible reasons for > this: > * If they are from different mysql servers, it is possible that the > timezone is set differently for the two servers. Please see > http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html > for how to set the timezone for mysql. (It is also possible for > the client connection to set a connection-specific timezone, > but I do not think that is what is happening here.) > * The type of the columns is different, e.g., one could be a > DATETIME, and the other a TIMESTAMP. The mysql timezone > link above also explains how these are handled. > > Without going through the above could you not just set the timezone > for "reg_date" to UTC to get the result that you expect? > > Regards, > Gora. > -- Lance Norskog goks...@gmail.com