- What Grafana version and what operating system are you using? Grafana v11.3.0 (d9455ff7db) on Debian GNU/Linux 12 (bookworm), PostgreSQL 15.8 (Debian 15.8-0+deb12u1)
Hello everyone. I try to create a dashboard where the user can select a date from the database to retrieve information. For that, I have added a variable with the following sql request:
SELECT match_time_date FROM matchs;
The problem is: by using this synthax, I got timestamp and not a date:
So I tried to convert to a char the date:
SELECT to_char(match_time_date, 'DD-MM-YYYY HH24:MI') FROM matchs;
But the result is always in UTC, and not on the timezone of the browser or the one I set up in Grafana:
On the database side, this field is a timestamp with timezone (my database is on Europe/Paris time):
SELECT match_time_date FROM matchs;
postgres=# select match_time_date from matchs;
match_time_date
------------------------
2024-10-13 20:00:00+02
2024-10-20 21:30:00+02
2024-10-27 20:00:00+01
2024-11-03 20:00:00+01
2024-11-17 20:00:00+01
2024-11-10 09:00:00+01
2024-12-01 20:00:00+01
2024-11-24 20:30:00+01
(8 rows)
postgres=# \d+ matchs;
Table "matchs"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-------------------+--------------------------+-----------+----------+---------+----------+-------------+--------------+-------------
match_time_date | timestamp with time zone | | not null | | plain | | |
I didn’t find any solution yet. I would like to print the date on the local time. For example, if I’m in Paris, for the first one I want to see:
2024-10-13 20:00:00
And for London:
2024-10-13 18:00:00
Do you know if it’s possible to achieve that, and if yes, how ?
Thank you for your help.