The tz()
clause returns the Coordinated Universal Time (UTC) offset for the specified time zone.
Syntax
SELECT_clause [INTO_clause] FROM_clause [WHERE_clause] [GROUP_BY_clause] [ORDER_BY_clause] [LIMIT_clause] [OFFSET_clause] [SLIMIT_clause] [SOFFSET_clause] tz('<time_zone>')
Description
By default, TSDB for InfluxDB® stores and returns timestamps in UTC. The tz()
clause allows the returned timestamps to include the UTC offset. If the UTC Daylight Saving Time (DST) offset is applicable, the tz() clause also allows the returned timestamps to include the UTC DST offset. The returned timestamps must be in the RFC 3339 format so that the UTC offset or the UTC DST offset can be displayed as expected. The time_zone
parameter complies with the time zone syntax in the Internet Assigned Numbers Authority time zone database. The value of this parameter must be enclosed in single quotation marks (‘).
Examples
Return the UTC offset for the Chicago time zone
> SELECT "water_level" FROM "h2o_feet" WHERE "location" = 'santa_monica' AND time >= '2015-08-18T00:00:00Z' AND time <= '2015-08-18T00:18:00Z' tz('America/Chicago')
name: h2o_feet
time water_level
---- -----------
2015-08-17T19:00:00-05:00 2.064
2015-08-17T19:06:00-05:00 2.116
2015-08-17T19:12:00-05:00 2.028
2015-08-17T19:18:00-05:00 2.126
In the query results, the timestamps include the UTC offset -05:00
for the America/Chicago
time zone.
InfluxDB® is a trademark registered by InfluxData, which is not affiliated with, and does not endorse, TSDB for InfluxDB®.