[Geoserver-users] Time Zone issue with dates using GeoServer WFS

Hi

I have a PostGIS table which I am serving through Geoserver v2.5 that has a date format column of dates. Using this table, I have created a web application which uses an ajax request to pull through the fields from this table via the Openlayers 3 WFS read features format.

The problem I am encountering is, for any dates that fall within British summer time (GMT Daylight Saving Time), it appears to be moving the actual date back by one day (i.e. for a date stored as 8th September 1993 in PostGIS, it is displaying as 07/09/1993 in my HTML / Javascript web application). The field is not a timestamp field, it is just a date field so from what I can gather it shouldn’t be storing any information on time zones?

I have asked this question on both the Openlayers stack overflow group and on a coding forum specifically dealing with javascript and it doesn’t appear to be an issue with how the date is being formatted, so I am wondering if there could be any potential problems when serving the table through Geoserver? Does anyone have any possible things I can check to see why this might be occurring?

Thanks, Chris

On Wed, Jun 22, 2016 at 9:50 AM, Chris Buckmaster <
chris.buckmaster@anonymised.com> wrote:

The problem I am encountering is, for any dates that fall within British
summer time (GMT Daylight Saving Time), it appears to be moving the actual
date back by one day (i.e. for a date stored as 8th September 1993 in
PostGIS, it is displaying as 07/09/1993 in my HTML / Javascript web
application). The field is not a timestamp field, it is just a date field
so from what I can gather it shouldn’t be storing any information on time
zones?

There was a discussion about this topic on geotools-devel some time ago,
the outcome was that yes, also dates have timezone (not hard to grasp,
e.g., now it's Wednesday here in Europe, but in a few hours it will be
Thursday in Australia). I believe that the outcome was also that it's
useful to add a configuration flag
for those that do not work in an international settings, so that the dates
do not get modified in those cases.
According to the docs there is a system variable you can set:
http://docs.geotools.org/latest/userguide/library/metadata/geotools.html

So starting your JVM with -Dorg.geotools.localDateTimeHandling=true should
change the behavior. It would be nice to have that as a global setting
in the GeoServer UI... anyone interested in coding it? :slight_smile:

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------

On Wed, Jun 22, 2016 at 10:45 AM, Andrea Aime <andrea.aime@anonymised.com>
wrote:

There was a discussion about this topic on geotools-devel some time ago,

the outcome was that yes, also dates have timezone (not hard to grasp,
e.g., now it's Wednesday here in Europe, but in a few hours it will be
Thursday in Australia). I believe that the outcome was also that it's
useful to add a configuration flag
for those that do not work in an international settings, so that the dates
do not get modified in those cases.
According to the docs there is a system variable you can set:
http://docs.geotools.org/latest/userguide/library/metadata/geotools.html

Oh, forgot to add, this settings is available, as far as I know, only
starting with GeoServer 2.9.0

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------

Thanks for your reply Andrea.

I have Geoserver installed as a Windows service and am not too knowledgeable on the Java environment – is this an application that can be installed to link into Geoserver to change the settings then? Am I able to change the Geoserver config settings to reflect the below through the config files if this isn’t possible using the UI?

Thanks, Chris

···

On Wed, Jun 22, 2016 at 9:50 AM, Chris Buckmaster <chris.buckmaster@…7473…> wrote:

The problem I am encountering is, for any dates that fall within British summer time (GMT Daylight Saving Time), it appears to be moving the actual date back by one day (i.e. for a date stored as 8th September 1993 in PostGIS, it is displaying as 07/09/1993 in my HTML / Javascript web application). The field is not a timestamp field, it is just a date field so from what I can gather it shouldn’t be storing any information on time zones?

There was a discussion about this topic on geotools-devel some time ago, the outcome was that yes, also dates have timezone (not hard to grasp,

e.g., now it’s Wednesday here in Europe, but in a few hours it will be Thursday in Australia). I believe that the outcome was also that it’s useful to add a configuration flag

for those that do not work in an international settings, so that the dates do not get modified in those cases.

According to the docs there is a system variable you can set:

http://docs.geotools.org/latest/userguide/library/metadata/geotools.html

So starting your JVM with -Dorg.geotools.localDateTimeHandling=true should change the behavior. It would be nice to have that as a global setting

in the GeoServer UI… anyone interested in coding it? :slight_smile:

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit

http://goo.gl/it488V for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


Ah, bummer – any suggestions when using version 2.5, or would I need to upgrade? Or any ways I can serve my data in different ways so it will not modify my dates and introduce time zone details?

···

On Wed, Jun 22, 2016 at 10:45 AM, Andrea Aime <andrea.aime@…1107…> wrote:

There was a discussion about this topic on geotools-devel some time ago, the outcome was that yes, also dates have timezone (not hard to grasp,

e.g., now it’s Wednesday here in Europe, but in a few hours it will be Thursday in Australia). I believe that the outcome was also that it’s useful to add a configuration flag

for those that do not work in an international settings, so that the dates do not get modified in those cases.

According to the docs there is a system variable you can set:

http://docs.geotools.org/latest/userguide/library/metadata/geotools.html

Oh, forgot to add, this settings is available, as far as I know, only starting with GeoServer 2.9.0

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit

http://goo.gl/it488V for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


On Wed, Jun 22, 2016 at 10:52 AM, Chris Buckmaster <
chris.buckmaster@anonymised.com> wrote:

Ah, bummer – any suggestions when using version 2.5, or would I need to
upgrade? Or any ways I can serve my data in different ways so it will not
modify my dates and introduce time zone details?

GeoServer reports dates and times in GMT, so you can set the entire system
to be on GMT to avoid shifts.

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

-------------------------------------------------------

That sounds like what I might need – is that altering the config file in the WEB-INF folder? Is there documentation online for carrying this out?

···

On Wed, Jun 22, 2016 at 10:52 AM, Chris Buckmaster <chris.buckmaster@…7473…> wrote:

Ah, bummer – any suggestions when using version 2.5, or would I need to upgrade? Or any ways I can serve my data in different ways so it will not modify my dates and introduce time zone details?

GeoServer reports dates and times in GMT, so you can set the entire system to be on GMT to avoid shifts.

Cheers

Andrea

==

GeoServer Professional Services from the experts! Visit

http://goo.gl/it488V for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.