Managing Timezone Settings in Snowflake

Understand timezone settings in Snowflake. How to check them, change them, and key best practices.

Snowflake icon and world time zone icon

Photo: Propel

Setting the correct timezone for your Snowflake account, user, and sessions is an often overlooked aspect of building with Snowflake. This post will guide you through why it's important, how to check and adjust your time settings, and key best practices for managing timezones in Snowflake.

Why is Your Snowflake's Account, User, and Session Timezone Important?

Understanding the role of timezone settings in Snowflake is crucial for accurate data analysis and interpretation. There are three timezone settings you'll encounter in Snowflake - the account, the user, and the session timezone.

The account timezone, which is set at the instance level, serves as the default for all sessions and influences various operations, such as timestamp generation. On the other hand, the user and session timezone applies to a single user or session and impacts the interpretation of timestamp data within that session. A session timezone, if set, will override the account timezone.

How to Check What Timezone the Snowflake Account and Session Are On

To check the timezone of your Snowflake account or session, use the following queries:

-- To check your account timezone
SHOW PARAMETERS LIKE 'TIMEZONE';

-- To check your session timezone
SELECT CURRENT_TIMESTAMP();

The first command shows the account's timezone, while the second returns the current timestamp for the session, where you can see on what timezone it is.

Best Practices for Setting Timezones: Keep Everything in UTC

When it comes to setting timezones in Snowflake, our recommended best practice is to keep everything in Coordinated Universal Time (UTC). Using UTC as your standard can simplify data analysis and comparisons, as it eliminates the issues caused by daylight saving time changes and regional differences.

How to Change the Session or User's Timezone

To change the timezone for your session in Snowflake, use the <span class="code-exp">ALTER SESSION</span> or <span class="code-exp">ALTER USER</span> command:

ALTER SESSION SET TIMEZONE = 'UTC';

ALTER USER SET TIMEZONE = 'UTC';

This command sets the session or user timezone to UTC. You can replace 'UTC' with any valid timezone identifier, according to your needs.

You can specify a time zone name or a link name from release 2021a of the IANA Time Zone Database (e.g. <span class="code-exp">America/Los_Angeles</span>, <span class="code-exp">Europe/London</span>, <span class="code-exp">UTC</span>, <span class="code-exp">Etc/GMT</span>, etc.).

How to Change the Account's Timezone

To change the account timezone, you'll need to have the ACCOUNTADMIN role. The command to modify the account timezone is as follows:

ALTER ACCOUNT SET TIMEZONE = 'UTC';

Remember that changing the account timezone will impact all sessions unless they have a different session timezone set.

Source: Snowflake Documentation

Conclusion

Setting up timezones correctly in your Snowflake account and sessions is crucial for accurate data interpretation. By following these steps and best practices, you can ensure precise time handling for your Snowflake operations.

Further Reading

If you are interested in diving deeper into Snowflake capabilities, here are some blog posts you might find useful:

  1. Snowflake API: Comprehensive Guide to 3 Methods With Examples
  2. How to reduce Snowflake costs: A five-point checklist
  3. How to build in-product analytics with Snowflake and GraphQL

If you don’t have a Propel account yet, you can try Propel for free and start building data apps.

Related posts

Managing Timezone Settings in Snowflake

This is some text inside of a div block.

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Block quote

Ordered list

  1. Item 1
  2. Item 2
  3. Item 3

Unordered list

  • Item A
  • Item B
  • Item C

Text link

Bold text

Emphasis

Superscript

Subscript

How to reduce Snowflake costs: A five-point checklist

This is some text inside of a div block.

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Block quote

Ordered list

  1. Item 1
  2. Item 2
  3. Item 3

Unordered list

  • Item A
  • Item B
  • Item C

Text link

Bold text

Emphasis

Superscript

Subscript

Analytics for LLM Apps: The Metrics Developers Need to Track with the ChatGPT API

This is some text inside of a div block.

Heading 1

Heading 2

Heading 3

Heading 4

Heading 5
Heading 6

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Block quote

Ordered list

  1. Item 1
  2. Item 2
  3. Item 3

Unordered list

  • Item A
  • Item B
  • Item C

Text link

Bold text

Emphasis

Superscript

Subscript

Start shipping today

Deliver the analytics your customers have been asking for.