I am experimenting with InfluxDB for timeseries datastore solution, and having an issue with using InfluxDB with different timezones.
Essentially, I am writing all data points into InfluxDB with UTC timestamps, but in the queries it would be very convenient (especially for testing) to specify timestamp ranges using the local timezone of the server.
Does anybody know how to achieve this in InfluxDB?
You can compute timezone before or after query to Influxdb by your side, another solutions I don't see. And btw, use everywhere utc timezone it's really good decision, and compute to time zone do you need only in last point.
Given that displaying the time in a specified timezone isn't possible, I don't think it's possible to set the timezone for interpreting time values in queries either.
The best you can do is to specify the GMT offset in each time value, and also add the matching tz('...')
at the end of the query, to display the time in the desired timezone.
SELECT * FROM measurement
WHERE time >= '2020-01-10T23:45:56-04:00'
AND time < '2020-01-10T23:45:59-04:00'
tz('America/New_York')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With