How to perform diff between global variable and current timestamp within influxdb query?

I am trying make use of ${__to} within a influxDB query. I want to get the number of days between current date and ${__to}. I assumed something like this would work but I get an error. Can someone please advise.

I am trying to do this
now() - ${__to} and convert that into int. But I am not able to get it working.

Welcome to the forum. Are you using InfluxQL or Flux?

I am using InfluxQL for this work.

Sorry, but I do not know how to do that in InfluxQL. In Flux the function is elapsed()

1 Like