Docker App uses UTC time and its not adjusted for local time

Hi, the docker app stores all data in UTC time. Local time is not respected when displaying data.

The current phone app settings have no affect on the local docker app

Note it is possible to set local time zone in a Docker container with the environment variable TZ="my/timezone"

This at least displayed the weather for Brisbane, AU where I live instead of a town in France.  

Also, data sent to pvoutput.org  is being sent as UTC time when local time should be used per this forum post by the owner of pvoutput.org

https://forum.pvoutput.org/t/clarification-are-date-times-in-local-or-utc/570


It would be great if this issue could be fixed.

Thread Status
4
45
3
1
0

Sort replies by:


Look at the time zone on the picture is
TZ Australia/Brisbane
Not TZ "Australia/Brisbane"
, Change the settings here first, if you still have questions, please leave a message for details

The Docker container is running on a Synology NAS and the environment is set for the correct time zone as shown in the environment variables at the bottom right. From what I have read, TZ support is part of the envieonment.I think the time zone is being set because the weather icon is set to my time zone. Before I set the tmezone the weather tile was for a city in France on the UTC +00:00 time zone. See below.I would not expect that setting the container  localtime would alter the UTC log

Hi, 

The docker provides a method to set the timezone.

you can search “set timezone in docker”

This is the result on the top.

Set timezone in your docker image

  1. RUN apt update && apt install tzdata -y ENV TZ="America/New_York"
  2. FROM debian:10 ENV TZ="America/New_York"
  3. RUN apt-get update && \ apt-get install -yq tzdata && \ ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \ dpkg-reconfigure -f noninteractive tzdata.

The Docker container is running on a Synology NAS and the environment is set for the correct time zone as shown in the environment variables at the bottom right. From what I have read, TZ support is part of the envieonment.

I think the time zone is being set because the weather icon is set to my time zone. Before I set the tmezone the weather tile was for a city in France on the UTC +00:00 time zone. See below.

I would not expect that setting the container  localtime would alter the UTC log data that is used to create the logs as each record needs to be adjusted.

I found it can easily be adjusted in your SQL query with something like:

SELECT CONVERT_TZ(UpdateTime,'+00:00','+10:00') as myLocalTime FROM `BIZ_MeterData` ORDER by Id DESC Limit 1;

This will retrieve the localtime of the last meter data entry recorded in the data table. But a new field would be required to hold the TZ offset as in SQL,  I found "Australia/Brisbane" was not recognised and a null field was returned.

Thanks, I have reconfigured the TZ environment variable as you suggested and it appears to be displaying correctly in our local time now. Thanks for great support!

Looks like you are new here. Register for free, learn and contribute.