Supports timezone in influxDB

Is converting to different timezone supported using TZ() method using the master branch of this repository
GitHub - influxdata/influxdb: Scalable datastore for metrics, events, and real-time analytics.
I found this link Support timezone offsets for queries by jsternberg · Pull Request #7762 · influxdata/influxdb · GitHub which specifes that it influxdb supports for some timezones.
And it also mentions that TZ(“America/Los_Angeles”) gives some error.
I am bit confused, whether it supports or not supports timezone while querying using cql.

In need of help.

Thanks in advance,

Yes, the master branch supports time zones. I don’t know if we have the documentation ready for that yet, but it should be soon.

Can you tell me more about the situation where you want to use time zones? The time zone declaration is mostly on useful in a few circumstances. The first is when you do something like GROUP BY time(1d). The time zone declaration will ensure that the day starts at midnight in the correct time zone and adjusts itself when the offset switches because of daylight savings time.

Also, TZ("America/Los_Angeles") is likely the wrong syntax. Originally, I had the PR written in a way where we used double quotes. It got changed to single quotes without me changing the commit message or the PR comment.

@Manoj_Maity Just to clarify, if you want the timezone support then you will need to download the nightly release for InfluxDB or build from source. Also the proper syntax for Timezones is TZ('America/Los_Angeles').

First of all thanks alot for replying.
In my scenario, user asks for last record for different timespan ranging from 5 min to 1month , grouped by 1min to 1day. Initially we were saving the time column by setting it to UTC time.
But when user from different timezones were querying data with there respective local time zones, data was fetched wrongly. So we started saving time column with local time zone and user fetch local time zone.
We are using influxdb for windows from
Kindly, suggest some other solution if any.

Thanks Again.

@Manoj_Maity We suggest people write everything in UTC then perform timezone shift on the client side. Does the nightly work for you?

I realize that I’m a bit late to the party, but I had some issues with getting the tz stuff to work. Until I tried it on a linux box, that is. I can only get TZ(‘whatever’) to work on linux, not windows.

I assume this has something to do with how influx reads the timezone info from the OS. Anyone have any idea if it’s possible to have it work under windows as well?

This is just a guess, but it probably has to do with how Go loads timezone information. From the LoadLocation documentation:

The time zone database needed by LoadLocation may not be present on all systems, especially non-Unix systems. LoadLocation looks in the directory or uncompressed zip file named by the ZONEINFO environment variable, if any, then looks in known installation locations on Unix systems, and finally looks in $GOROOT/lib/time/

Just figured it out myself: Time zone and group by day in influxdb – Joachim on tech
TL;DR: On Windows, install go and restart influxd :slight_smile:

1 Like

@mark Maybe we should add the to the Windows package?

The windows package is just a .zip of the influx binaries; there is no installer to speak of.

We could include the, but we’d need to add directions on putting it somewhere and then setting the ZONEINFO environment variable.

Any local Windows powerusers have opinions on how you’d like to see us approach this with Windows?