Query Flux2.0 time range


I’m having problem wirh querying the database, and I think it’s because of the date’s timezone.
I’m passing a date inserted in an excel cell but it always returns 1 hour in advance.
But if you put it manually (range(start: 2023-05-30T11:36:00Z)) it’s the same result .
Influxdb always returns data from 2023-05-30 12:36 and not from 11:16.

|> range(start: 2023-05-30T11:36:00Z, stop: 2023-05-30T15:00:00Z)

What can I do to resolve this issue?

influxDB uses UTC timestamp, you could use location offset functions to apply an offset on all time related stuff.

location package | Flux 0.x Documentation (influxdata.com)

But during the winter period, Portugal is in the UTC+0 time zone. However, during the summer period, Portugal moves forward by 1 hour and is in the UTC+1 time zone.
Is it possible to pass the time zone in the query? I see that on online manual tz(‘<time_zone>’).

Isn’t there an automatic way to do this or I have to check if I’m in the summer or winter period mannually?

yes but it is a little bit more complicated than that.

I have the same problem each time daylight savings kicks in I need to tweak all my tasks manually.

there is a timeZone Location option as described here:

timezone.location() function | Flux 0.x Documentation (influxdata.com)

But It may not work on your setup… it requires zoneInfo go repository installed more info here: Error while defining location parameter for aggregateWindow - Fluxlang - InfluxData Community Forums

There is not enough information out there about this, I haven’t implemented the solution because I need to restart my InfluxDB service, and I cannot do that until a scheduled shutdown…

but if You happen to be using windows 10 and InfluxDB running as a service using NSSM. I have on my notes right here next to me how to add the zoneInfo repository:

  1. download zoneinfo.zip to any Dir (preferably the one on which you launch InfluxDB)
  2. open nssm (navigate to nssm dir and type nssm edit )
  3. go to Enviroment tab add the dir where you downloaded zoneinfo.zip
  4. save, exit and restart service.