Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring timezones in InfluxDB

Tags:

influxdb

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?

like image 592
Taras Kinash Avatar asked Jan 26 '15 23:01

Taras Kinash


2 Answers

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.

like image 140
ezotrank Avatar answered Oct 29 '22 15:10

ezotrank


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')
like image 32
Dan Dascalescu Avatar answered Oct 29 '22 15:10

Dan Dascalescu