Search code examples
pythoninfluxdb

How to set time zone in InfluxDB using python client


I am using Python client for InfluxDb to write into Database as shown below.

    import pytz

    tz = pytz.timezone('US/Pacific')

client.write_points([{"measurement": system_id[1], "tags": tagdic, "time":ts, "fields": fielddic}])

When i run any query in D.B i am getting time information in UTC.

time    
2016-09-19T18:01:36.001482473Z  
2016-09-19T18:01:36.007748467Z  
2016-09-19T18:01:36.012061884Z

How can i get time info in my local time zone, considering it is US/Pacific?


Solution

  • You can't do that at the moment. There are a lot of github issues regarding that topic but they are not implemented yet. Here are some of them: Link1, Link2 , Link3

    But you can convert the time to your timezone after you selected your data of course.