Timestamp from Grafana doesn't match DB timestamp

Hello,

I’m currently seeing a mismatch from my postgresql database and what grafana sees when pulling a query.

As you can see below in the screenshot, I’m only doing a where clause where the date equals a specific date. You will notice the return says that column is equal to the day before (11/13/2022) instead of (11/14/2022) in which I searched.

Here are the settings for time within Grafana:
image

and the server time:

[flip@rodhost ~]$ date
Mon Nov 14 16:36:27 EST 2022

ebay=# select * from ebay_listings where rowid =‘240’;
-[ RECORD 1 ]±----------------
rowid | 240
item | [LOT] 10 R&B CDs
category | cd
location | A1
console |
spent | $10.00
potential | $20.00
quantity | 1
sold_price |
shipping |
ebay_fee |
ad_fee |
total_cost |
total_profit |
sold | N
date_listed | 2022-11-14 <---------------------
date_sold |

Is there another setting i’m missing?

Thanks in advance.

Grafana Version: 9.2.4
Postgresql: postgresql-9.2.24-8.el7_9.x86_64
OS: Linux CentOS 7

2022-11-14 is not exact date (timezone detail is missing), so it considered as 2022-11-14 00:00:00 UTC by Grafana. But your dashboard (browser) is in -5h (EST) timezone, so Grafana moves that date to dashboard timezone:
2022-11-14 00:00:00 UTC -5h = 2022-11-13 19:00:00 EST. It works fine.

How to fix it? I would say use timestampz (timestamp with timezone) datatype for your DB column. Naive workaround: make your table field of string type, so Grafana won’t be treat it as timestamp (so no timezone magic will be applied).

That makes total sense! Thank you, I’ll try this and update the thread.