How to convert dashboard start and end times to ISO date for AWS TimeStream

Using cloud version 8+

I am trying to query AWS TimeStream data between the start and end time of a dashboard time range. No matter what I try I get bad query error.

I can go and query the table directly at AWS by using the format below. I get good data:

SELECT * FROM “MyDtatbase”.“MyTable”
WHERE time > ‘2022-05-25 00:00:00’

I have found that you can get the start time and end time of the dashboard by using these functions:

${__from} and ${__to}

How does one convert milliseconds from epoch to the correct date format for AWS?

2022-05-25 00:00:00

Grafana tech support answered this question. There are functions built into the AWS Timestream plug in that do these kinds of things. The page spelling them out can be found here.

The usage to filter out data between the two time range pickers would be:

WHERE time > from_milliseconds($__from)
AND time < from_milliseconds($__to)