Enable or disable Time Zone Support for your data sources

Choose whether individual data sources will have a time zone conversion applied to their data, and if so, which time zone conversion type (named time zones or UTC offset).

Named time zones are preferable, especially if you plan to use SQL Mode, because the syntax is simpler. However, not all databases support named time zones. If you aren’t sure if your database supports the SET TIME ZONE syntax, see below.

From the top navigation, choose Data Sources > your data source.

There are 3 data source time zone settings:

  • Disabled: use this setting if your data source does not need its time zone adjusted.
  • Time Zone: the data source will use the SET TIME ZONE timezone_name syntax for its queries. If you don’t see Time Zone as an option, your database type does not support named time zones.
  • UTC Offset: the data source’s datetime values will be adjusted to your time zone by adding or subtracting hours from UTC. The UTC Offset is automatically populated based on the dashboard’s Time Zone setting, and will account for daylight savings time as needed.

Change time preferences in the data source settings

Time Zone vs. UTC Offset

Time Zone is preferable to UTC Offset, especially if you’ll be using SQL mode. Check your database type below to see how time zones are supported. If your database type is not listed, it does not support either Time Zones or a UTC Offset. If you are unsure, contact support.

Database typeTime Zone or UTC Offset?Supported column data typesSQL Mode usage
PostgreSQL (includes Heroku, Data Stores, CSVs)Time Zonetimestamptz, timestamp1applied automatically1
MySQLTime Zone2timestampapplied automatically
Redshift (includes Stitch)Time Zonetimestamptz, timestamp1applied automatically1
Google Analyticsnone3
Google BigQueryUTC Offsettimestamprequires special syntax4
Google CloudSQLUTC Offsettimestamprequires special syntax5
SQL ServerUTC Offsetdatetimerequires special syntax6

Time Zone SQL Mode syntax

If you are unsure what syntax is required for SQL Mode, simply add your date dimension in Interactive Mode, choose your desired time bucket (day, hour, etc.) and click Preview SQL to view an example.

  1. PostgreSQL, Redshift: In SQL Mode, cast timestamp and timestamptz columns to text in order to apply the time zone conversion, using TO_CHAR or ::text. In addition, timestamp columns must be set to UTC before the time zone conversion can be applied, using syntax SELECT (date_column AT TIME ZONE 'UTC').
  2. MySQL: In order to use the Time Zone setting with MySQL, you will need to have the time zone tables in your database. MySQL includes the tables automatically, but they may need to be manually loaded into the database. To check whether the time zone tables are already loaded, run the following query: select * from mysql.time_zone_name; If there are no results, see MySQL’s documentation for instructions on Populating the Time Zone tables. If you do not want to complete this process, you can use a UTC Offset instead.
  3. Google Analytics: Set your dashboard’s time zone to match your Google Analytics time zone.
  4. BigQuery: For BigQuery, wrap timestamps in TIMESTAMP_ADD(timestamp_column, INTERVAL {UTC_OFFSET.RAW} HOUR)
  5. Google CloudSQL: For Google CloudSQL, wrap timestamps in CONVERT_TZ(date_column,'+00:00','{UTC_OFFSET.RAW}:00')
  6. SQL Server/SQL Azure: For SQL Server and SQL Azure, wrap datetimes in DATEADD(hour, {UTC_OFFSET.RAW}, date_column)