All Products
Search
Document Center

Time Series Database:Time Zone clause

Last Updated:Aug 05, 2020

The tz() clause returns the Coordinated Universal Time (UTC) offset for the specified time zone.

Syntax

  1. 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

  1. > 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')
  2. name: h2o_feet
  3. time water_level
  4. ---- -----------
  5. 2015-08-17T19:00:00-05:00 2.064
  6. 2015-08-17T19:06:00-05:00 2.116
  7. 2015-08-17T19:12:00-05:00 2.028
  8. 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®.