1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Snowflake の TIMEZONE と TIMESTAMP型(3種類)の違い

Last updated at Posted at 2020-08-04

SnowflakeのTIMEZONE や TIMESTAMP型で 少しハマったので、メモしておきます。
あとで、もう少しキレイにするつもり。

デフォルトTIMEZONE は America/Los_Angeles

SnowflakeのデフォルトのTimezoneは America/Los_Angeles になっています。次のSQLを実行すると確認できます。

SHOW PARAMETERS LIKE 'TIMEZONE';

image.png

なので、CURRENT_TIMESTAMPを表示すると、米国カリフォルニア時間で返ってきます。

SELECT CURRENT_TIMESTAMP;

image.png

とりいそぎ日本時間で表示したければ、SESSION の TIMEZONE を変更すればOKです。

ALTER SESSION SET TIMEZONE = 'Asia/Tokyo';

image.png

SELECT CURRENT_TIMESTAMP;

image.png

TIMESTAMP型は3種類。それぞれの違い。

あとで書く

TIMESTAMP_LTZ

TIMESTAMP_NTZ

TIMESTAMP_TZ

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?