@Test
  public void timezoneTest() throws SQLException {
    try (Connection connection = EnvFactory.getEnv().getConnection();
        Statement statement = connection.createStatement()) {

      String insertSQLTemplate = "insert into root.timezone(timestamp,tz1) values(%s,%s)";
      connection.setClientInfo("time_zone", "+08:00");
      // 1514779200000 = 2018-1-1T12:00:00+08:00
      statement.execute(String.format(insertSQLTemplate, "1514779200000", "1"));
      statement.execute(String.format(insertSQLTemplate, "2018-1-1T12:00:01", "2"));
      statement.execute(String.format(insertSQLTemplate, "2018-1-1T12:00:02+08:00", "3"));
      statement.execute(String.format(insertSQLTemplate, "2018-1-1T12:00:03+09:00", "4"));
      statement.execute(String.format(insertSQLTemplate, "2018-1-1T12:00:04+07:00", "5"));

      connection.setClientInfo("time_zone", "+09:00");
      statement.execute(String.format(insertSQLTemplate, "1514789200000", "6"));
      statement.execute(String.format(insertSQLTemplate, "2018-1-1T14:00:05", "7"));
      statement.execute(String.format(insertSQLTemplate, "2018-1-1T12:00:03+08:00", "8"));
      statement.execute(String.format(insertSQLTemplate, "2018-1-1T12:00:06+07:00", "9"));

      // Asia/Almaty +06:00
      connection.setClientInfo("time_zone", "Asia/Almaty");
      statement.execute(String.format(insertSQLTemplate, "1514782807000", "10"));
      statement.execute(String.format(insertSQLTemplate, "1514782808000", "11"));
      statement.execute(String.format(insertSQLTemplate, "2018-1-1T13:00:09+08:00", "12"));
      statement.execute(String.format(insertSQLTemplate, "2018-1-1T12:00:10+07:00", "13"));

      ResultSet resultSet = statement.executeQuery("select * from root.**");
      int cnt = 0;
      try {
        while (resultSet.next()) {
          String ans = resultSet.getString(TIMESTAMP_STR) + "," + resultSet.getString(tz1);
          Assert.assertEquals(retArray[cnt], ans);
          cnt++;
        }
      } finally {
        resultSet.close();
      }
      Assert.assertEquals(13, cnt);
    }
  }
// execute in cli-tool CREATE DATABASE root.timezone CREATE TIMESERIES root.timezone.tz1 WITH
DATATYPE = INT32, ENCODING = PLAIN set time_zone=+08:00 insert into
root.timezone(timestamp,tz1) values(1514779200000,1) insert into root.timezone(timestamp,tz1)
values(2018-1-1T12:00:01,2) insert into root.timezone(timestamp,tz1)
values(2018-1-1T12:00:02+08:00,3) insert into root.timezone(timestamp,tz1)
values(2018-1-1T12:00:03+09:00,4) insert into root.timezone(timestamp,tz1)
values(2018-1-1T12:00:04+07:00,5)

<p>set time_zone=+09:00 insert into root.timezone(timestamp,tz1) values(1514789200000,6) insert
into root.timezone(timestamp,tz1) values(2018-1-1T14:00:05,7) insert into
root.timezone(timestamp,tz1) values(2018-1-1T12:00:03+08:00,8) insert into
root.timezone(timestamp,tz1) values(2018-1-1T12:00:04+07:00,9) set time_zone=Asia/Almaty insert
into root.timezone(timestamp,tz1) values(1514782807000,10) insert into
root.timezone(timestamp,tz1) values(2018-1-1T11:00:08,11) insert into
root.timezone(timestamp,tz1) values(2018-1-1T13:00:09+08:00,12) insert into
root.timezone(timestamp,tz1) values(2018-1-1T12:00:10+07:00,13)

<p>select * from root.**
integration-test/src/test/java/org/apache/iotdb/db/it/IoTDBTimeZoneIT.java