[Geoserver-users] set timezone before starting geoserver

I had a pb of datetime translation by geoserver :

I insert data via wfs
<wfs:Insert>
<wims:ice gml:id="ice.200703040015000000_0">
    <wims:validity_start_time>2007-10-16T*12:10:52.000*Z</wims:validity_start_time>
</wims:ice>
</wfs:Insert>

Connected via psql to the DB, i request it : select validity_start_time from ice;
validity_start_time
---------------------
2007-10-16 *14:10:52+00*
WRONG !!

Query on the log of geoserver :
net.opengis.wfs.impl.InsertElementTypeImpl@anonymised.com (feature: [Feature[ id=ice.200703040015000000_0 , type=ice , validity_start_time=*2007-10-16 14:10:52.0* , ....

It seems that geoserver makes the transformation of the date, according to ???
That is before inserting data in the db.
So the pb (if there is one) is in geoserver.
configuration pb ? yes, in fact no.

There was no TZ environment variable setted, so geoserver took one by default (which one ? i do not know), for me it was GMT+2. So each date in wfs request was translated to GMT+2.

I just have to set the TZ environment to GMT before start my geoserver.

It could helps someone.

Seb

Sébastien Geindre ha scritto:

I had a pb of datetime translation by geoserver :

I insert data via wfs
<wfs:Insert>
<wims:ice gml:id="ice.200703040015000000_0">
    <wims:validity_start_time>2007-10-16T*12:10:52.000*Z</wims:validity_start_time>
</wims:ice>
</wfs:Insert>

Connected via psql to the DB, i request it : select validity_start_time from ice;
validity_start_time
---------------------
2007-10-16 *14:10:52+00*
WRONG !!

Query on the log of geoserver :
net.opengis.wfs.impl.InsertElementTypeImpl@anonymised.com (feature: [Feature[ id=ice.200703040015000000_0 , type=ice , validity_start_time=*2007-10-16 14:10:52.0* , ....

It seems that geoserver makes the transformation of the date, according to ???
That is before inserting data in the db.
So the pb (if there is one) is in geoserver.
configuration pb ? yes, in fact no.

There was no TZ environment variable setted, so geoserver took one by default (which one ? i do not know), for me it was GMT+2. So each date in wfs request was translated to GMT+2.

I just have to set the TZ environment to GMT before start my geoserver.

It could helps someone.

Yeah, date handling on the write side in GeoServer is broken.
I tried to propose a solution some time ago but other developers
thought that was too hackish so in the end nothing was done and
date writing is still broken.

Anyways, setting timezone to GMT is possible. You have to provide
the "user.timezone" system variable to your java vm. In your
case passing -Duser.timezone=GMT should do the trick.

Hope this works for you
Cheers
Andrea