# Python3, query a point, the time is inconsistent

**URL:** <https://community.influxdata.com/t/python3-query-a-point-the-time-is-inconsistent/16735>\
**Category:** Welcome & Getting Started\
**Tags:** query, python\
**Created:** [November 14, 2020, 3:31pm UTC](https://community.influxdata.com/t/python3-query-a-point-the-time-is-inconsistent/16735 "2020-11-14T15:31:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![yoshinari\_lee](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/yoshinari_lee/32/5960_2.png) [@yoshinari\_lee](https://community.influxdata.com/u/yoshinari_lee)\
**Post date:** [November 14, 2020, 3:31pm UTC](https://community.influxdata.com/t/python3-query-a-point-the-time-is-inconsistent/16735/1 "2020-11-14T15:31:04Z")

</div>

Hi, I have a python script to monitor linux system. When I query a point using python script, the time is not localtime. Python script is as follows:

```auto
    import influxdb
    n = influxdb.InfluxDBClient('127.0.0.1', '8086','root','123456', 'test')
    res = n.query("select cpu, mem, mmcblk0, mmcblk0_r, mmcblk0_w, rec, trans, net, tcp, retrans from \"127.0.0.1\" where time>'2020-11-14 21:30:07' and time<'2020-11-14 21:31:07' and type='system' tz('Asia/Shanghai')")

```

the result is:

```auto
    'time': '2020-11-14T13:30:07.461109Z', 'cpu': 8.29
    'time': '2020-11-14T13:30:10.603102Z', 'cpu': 2.26
    'time': '2020-11-14T13:30:13.684848Z', 'cpu': 4.75
    'time': '2020-11-14T13:30:16.828245Z', 'cpu': 1.25
    'time': '2020-11-14T13:30:19.911986Z', 'cpu': 8.01
    'time': '2020-11-14T13:30:23.053864Z', 'cpu': 1.0
    'time': '2020-11-14T13:30:26.136214Z', 'cpu': 5.23

```

When I run the same query in InfluxDB shell, the time is localtime, as follows:

```auto
    use test
    precision rfc3339
    select cpu, mem, mmcblk0, mmcblk0_r, mmcblk0_w, rec, trans, net, tcp, retrans from "127.0.0.1" where time>'2020-11-14 21:30:07' and time<'2020-11-14 21:31:07' and type='system' tz('Asia/Shanghai')

```

the result is:

```auto
        time cpu 
        ---- --- 
    2020-11-14T21:30:07.461108798+08:00 8.29
    2020-11-14T21:30:10.603102483+08:00 2.26
    2020-11-14T21:30:13.684848386+08:00 4.75
    2020-11-14T21:30:16.828244687+08:00 1.25
    2020-11-14T21:30:19.911986384+08:00 8.01
    2020-11-14T21:30:23.053864202+08:00 1   
    2020-11-14T21:30:26.136213792+08:00 5.23

```

 ![test](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/f/f25676580a1de6e96ed50c473a03977095b6de94.jpeg)

version:

```auto
python 3.8
influxdb 1.8.3
python-influxdb 5.3.0

```

Why the above two ways are different? Can you tell me how to modify python script? I don’t want to write a python script to convert time.

thank you for helping me !

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [November 24, 2020, 6:39pm UTC](https://community.influxdata.com/t/python3-query-a-point-the-time-is-inconsistent/16735/2 "2020-11-24T18:39:00Z")

</div>

Hello @yoshinari_lee,  
have you tried using the time param like:

> <https://github.com/influxdata/influxdb-python/blob/7d82f9371176699f8d6f9c4d0b0133ed5bd20275/influxdb/tests/test_line_protocol.py#L57>

Thank you
