Today() bringing yesterday data

Hi all

I have a influx 2.1.1 docker running with TZ as America/Sao_Paulo which is equal UTC-3. When I run the query below and check for the data it shows data from yesterday’s 9:00 pm onwards.

from(bucket: “energia”)
|> range(start: today())
|> filter(fn: (r) => r["_measurement"] == “ept”)
|> difference(nonNegative: true)
|> aggregateWindow(
every: 30m,
fn: sum)
|> cumulativeSum()

I double checked and the console of the docker date command show the right time and timezone.
What’s happening ? What am I doing wrong ?

Hi all,

No ideas or suggestions ?

Hello @Andre_Martins,
The today() function returns the now() timestamp truncated to the day unit.
where
The now() function returns the current time (UTC) or the time defined in the now option.
now() function | Flux 0.x Documentation
Have you tried using the timezone package?
timezone package | Flux 0.x Documentation

Yes I have, this is how it is now and it did change the result.

import “timezone”

option location = timezone.location(name: “America/Sao_Paulo”)

from(bucket: “energia”)
|> range(start: today())
|> filter(fn: (r) => r["_measurement"] == “ept”)
|> difference(nonNegative: true)
|> aggregateWindow(
every: 30m,
fn: sum)
|> cumulativeSum()

In the quert inspector data I can see that the first set of results is from yesterday 9:30 PM

Hello @Andre_Martins,
Are you using the InfluxDB UI?
Have you set your time to Local or UTC? You can select the right one in the top right hand corner.