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 https://www.influxdata.com/
Kindly, suggest some other solution if any.
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/zoneinfo.zip.