Looker can make time-based data easier to understand by converting it to different time zones. Users can see query results and create filters with time-based data that is converted to their local time zones. For example, a user in New York viewing data created in California doesn’t have to manually subtract three hours to filter or interpret their queries.
Looker converts time-based data when it generates SQL during a query for a Look, an Explore, or a dashboard. The underlying data is not affected; rather, the query results are converted using Looker’s time zone settings. This also means that queries run using SQL Runner do not convert time-based data.
Several settings within Looker specify how to convert time-based data:
System Time Zone
The System time zone is the time zone for which the server running Looker is configured. Looker’s internal database, which stores the information available in the
i__looker and System Activity Explores, stores time-based data in the System time zone.
The System time zone is not configurable through the Looker application. For Looker-hosted instances, the System time zone is always set to UTC. Customer-hosted instances may be in a different System time zone. Changing the System time zone is not trivial and is not recommended. If you need to adjust timestamps in an
i_looker or a System Activity Explore, Looker recommends using table calculations to create time-adjusted columns. For example, to convert from UTC to EST, you could create a column with the table calculation
Database Time Zone
When you add a connection to a database, you set the value for the Database Time Zone on the Connection Settings page:
This setting represents the time zone used to interpret your raw data. This is frequently set to the time zone in which your data is created or the time zone in which your organization is based. It could also be set to Coordinated Universal Time (UTC).
User Specific Time Zones
The most significant setting for time-based data conversion is the User Specific Time Zones option, which is on the General Settings page in the Admin section of Looker:
You can enable or disable User Specific Time Zones:
- When enabled, each Looker user is assigned to a time zone, and that time zone specifies the appearance of their query results.
- When disabled, users don’t have individual time zones assigned to their accounts. Rather, all queries run using the Query Time Zone value.
With User Specific Time Zones enabled, a user can set their time zone on their Account page, or Looker admins can assign time zones to users on the Users page. If a time zone isn’t set for a user, their account defaults to the Looker Application Time Zone setting.
Whenever a user creates a query, that query is created in the user’s time zone. As a result, when a query returns time-based data, Looker converts the data from the Database Time Zone to the user’s time zone. When a user uses time-related filter values in a query, Looker converts the filter values to the Database Time Zone.
In addition, when you enable this option, Looker displays a drop-down menu in Explores, dashboards, and Looks:
Options in this drop-down are:
- Each Tile’s Time Zone (dashboards only): All queries run in the time zone they were saved with.
- Viewer Time Zone: All queries run in the user’s current time zone setting.
- A list of every individual time zone, which users may manually choose if they like.
All queries default to the time zone the query was created with. In other words, if Alice creates a query with time zone “America/Los Angeles” and sends it to Bob, Bob will see the query with time zone “America/Los Angeles,” even if Bob’s time zone is set to “America/New York.” Similarly, drilling always defaults to whatever time zone the query was created with.
Whenever viewing a query, users can use the drop-down to override the time zone, picking their Viewer Time Zone or any different time zone for that query or that dashboard’s set of queries.
Things to Consider with User Specific Time Zones
When you enable User Specific Time Zones, users in different time zones see data differently, according to how filters are applied to each time zone. For example, the following query has a filter of
last month and was run in the New York time zone:
The same query run in the Seoul time zone returns different results:
The underlying data is not different; the exact hours making up the time period
last month are slightly different.
Application Time Zone
The Application Time Zone setting is on the General Settings page in the Admin section of Looker:
The Application Time Zone is the default time zone for scheduling data deliveries. The time zone used for schedules does not affect time-based data returned by a query. It only affects the time a data delivery is sent.
If you enable the User Specific Time Zones option, the Application Time Zone is the default time zone for users that do not have a time zone value set for their accounts.
Query Time Zone
The Query Time Zone option is visible only if you have disabled User Specific Time Zones. In that case, you set the Query Time Zone value when you add a connection to a database on the Connection Settings page:
If you disable User Specific Time Zones, all queries of time-based data use the Query Time Zone and Looker converts all time-based data from the Database Time Zone to the Query Time Zone.
Database Dialect Support for Time Zone Conversion
Looker’s ability to convert time zones depends on each database dialect’s support of this functionality. The list below shows which dialects support time zone conversion in the most recent Looker release.