Flux query to return time in different zone

Hi there,

I have a flux query that returns a time column that ends with ‘:00Z’.

Is there a way for the query to return that column but ends with for example ‘:-00:08’? Or something that’s not ‘Z’ - UTC?

Thanks

Hi,

In flux it will return with 00Z, if there any front end like Grafana for influx, then the date will display 00:08 without Z.

so it’s up to the frontend code to decode these data string? Basically have to go through all the rows and make the adjustment right?

We have a reporting tool that just output a spreadsheet, we don’t have any fancy grafana or any graphing libraries.

Is not a data string. Is an RFC3339 timestamp, that in this case on the spread sheet will be dumped as a string.

Work with time types | Flux Documentation (influxdata.com)

however, there are time zone functions, time offset functions, and also string functions. so yea you can convert the time to whatever format you need.

Thing is when the influx API returns the response, it’s presented as a string with 00Z, meaning in UTC timezone. Yes I’m using the HTTP API, not the influx web UI or cli.

Is there a function that does this from influx’s side? So that the query response returned from the API have a different timezone instead of UTC?

Hi, take a look at this (untested by my side).

YES. just read the documentation.

timezone.fixed() function | Flux Documentation (influxdata.com)

timeShift() function | Flux Documentation (influxdata.com)

strings package | Flux Documentation (influxdata.com)

trust me I am not an expert, I just read the documentation…