-1

I'm trying to create a query-variable using a Timescale data source. This is my query: select distinct datetime from test And what i get is:

Preview of values
All
1614556801000
1617235201000
1619827201000
1622505601000
1630454401000

The desired result would be a human readable date format. The solution suggested here doesn't work as I use Timescale: https://community.grafana.com/t/date-format-changing-to-epoch-time-format-when-assigned-as-a-variable/51812

Jan Garaj
  • 25,598
  • 3
  • 38
  • 59

2 Answers2

2

Not sure it applies to your use-case but for a similar problem, I ended up rewriting my SQL query like this:

SELECT to_char(datetime,'MM-DD') AS "time"
FROM ...
0

Thank You, this has led me to a solution:

select distinct to_char(datetime, 'yyyy-MM-DD') from test

  • Welcome to SO! As you are a new member, you cannot make comments. Your reply is a comment rather than an answer. In fact it is the same that you already received. Please, just introduce an answer when it is new. – David García Bodego Dec 09 '21 at 09:30