Hi!
I am having a strange issue with timestamp data from a postgresql-db.
There is a table with a “timestamp with timezone”.
Data is stored like “2020-06-10 07:00:06+02”.
I have a table view to show the data in grafana. The query is like to_char(beigestellt_vabis, 'YYYY-MM-DD HH24:MI:SS') as beigestellt_vabis
In grafana 6.7.2 everything is as we expect it:
In grafana 7.0.3 the time is two hours “too late”:
The Timezone for the dashboard is “local browser time” and everything else is exactly the same (in fact the 7.0.3 machine is a fresh clone of the 6.7.2 machine). I am also using the same browser on the same client, only different tabs.
Does anyone know if there where any changes regarding this between 6.7.2 and 7.0.3?
Is this maybe a bugfix? Any help would be really great!
Best regards and thanks in advance,
Otto
I cannot comment on the difference between 6.7.2 and 7.0.3 (mainly because I
haven’t “upgraded” to 7.x yet, mostly due to the number of comments on this
list indicating problems or unexpected differences from 6.x), hower I would
say:
I strongly recommend storing your timestamps as numeric Epoch-format
timestamps in your database and not as strings with timezones attached.
Any timezone conversion you wish to do should be done after extracting the (by
default) UTC-zone Epoch timestamp from the database. Grafana does this
automatically for you where appropriate.
Storing timestamps in a database as strings is inefficient and makes some
queries difficult-to-impossible, and storing timestamps in a database with
timezone included leads to all sorts of problems when you come to extract that
data later and try to interpret it.
Hi!
Thank you for your fast answer an suggestion!
But this IS what we did. Timestamp is NOT a string (as far as I know). Why do you think we use a string for storing this in the database?
Best regards and thanks in advance,
Otto