docs-v2 icon indicating copy to clipboard operation
docs-v2 copied to clipboard

plz help me it not filter the data on timezone i tried it as well

Open xalteropsx opened this issue 2 years ago • 2 comments

Describe the issue here. option location = timezone.location(name: "Europe/Istanbul") from(bucket: "os2_db") |> range(start: 0) |> filter(fn: (r) => r["_measurement"] == "os_records")|> filter(fn: (r) => exists r["_field"])|> truncateTimeColumn(unit: 10s)|>last()

here my query it doesnt give me current time of istanbul

Relevant URLs
  • https://docs.influxdata.com/flux/v0.x/stdlib/timezone/location/
  • Provide other relevant URLs (project issues, community threads, etc.)

xalteropsx avatar Mar 16 '23 09:03 xalteropsx

@xalteropsx the location option doesn't modify timestamps. It changes how window() works when generating windows of time that cross time change boundaries (like daily savings time or British summer time).

To actually modify timestamps, use timeShift() with the UTC-relative offset of your timezone.

option location = timezone.location(name: "Europe/Istanbul")

from(bucket: "os2_db")
    |> range(start: 0)
    |> filter(fn: (r) => r["_measurement"] == "os_records")
    |> filter(fn: (r) => exists r["_field"])
    |> truncateTimeColumn(unit: 10s)
    |> timeShift(duration: 3h)
    |>last()

sanderson avatar Mar 17 '23 15:03 sanderson

@sanderson thank u very much it working great

xalteropsx avatar Mar 19 '23 14:03 xalteropsx