DateTime item shows UTC time although timezone is Europe/Berlin

Tags: #<Tag:0x00007f5ca65ab2c0>

I am using 2.5.0M1.

MQTT generic channel is configured like this:
Type datetime : GF_TechRoom_THtimestamp "TechRoom T/H Sensor" [ stateTopic="zigbee2mqtt/tempsensor_techroom" , transformationPattern="JSONPATH:$.last_seen" ]

Corresponding item is configured like this:
DateTime GF_TechRoom_THtimestamp "Last Seen [%1$tA, %1$td.%1$tB.%1$tY, %1$tT]" <humidity> (GF_TechRoom, gHumidity) {channel="mqtt:topic:rpi3knx:zigbee:GF_TechRoom_THtimestamp"}

If the MQTT Generic binding receives the following MQTT payload {"last_seen":"2019-02-18T20:22:05.628Z"}, the DateTime simply shows this (UTC) time instead of the correct local time in the configured timezone which would be something like 18.02.2019, 21:22:05.628
(with one hour added)
I consider this to be a bug.

Can anyone confirm this behaviour?

It’s not a bug but reflects your system setup.
Use ps to see if your java is given a timezone to start with. If no and your system clock runs on UTC that’s what java uses regardless of your local user’s TZ setting.
Try adding "-Duser.timezone=Europe/Berlin" to the options line beginning with EXTRA_JAVA_OPTS in /etc/default/openhab2 an restart OH.

Hi Markus!

I am running OH2 in a docker container and the mentioned option is already added to EXTRA_JAVA_OPTS.
The OH log says:
2019-02-17 12:13:48.958 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to 'Europe/Berlin'.

/etc/timezone in the container also contains “Europe/Berlin”. /etc/localtime matches the configured timezone.

That’s why I consider this a bug: although it is setup correctly, the time is not displayed correctly.

What I see here seems to be correct from my understanding:


I should also mention that the timestamps in the OH logs of the log entries themselves are correct.

Can someone point me to the UI part in the code which gets involved when a DateTime item is to be displayed using BasicUI?
Would it not be necessary that the timezone of the browser (the viewer) needs to be taken into account?
Or is it always assumed that the user of the OH instance is within the same timezone that OH is configured for (which is ok for me)?

where is this information stored when /etc/default/openhab2 is not present?

edit:
I’ve added EXTRA_JAVA_OPTS to the start.sh script and seems to work OK