LoginSignup
13
5

More than 5 years have passed since last update.

BigQuery標準SQLでUTCをJSTに変換する

Posted at

日付のみを取得する場合はDATE関数、日時を取得する場合はDATETIME関数を使用する。

SELECT
  timestamp
  ,DATE(timestamp, 'Asia/Tokyo') as DT
  ,DATETIME(timestamp, 'Asia/Tokyo') as TIME 
FROM
  `PROJECT.DATASET_TABE` 
where
  DATE(timestamp, 'Asia/Tokyo') >= '2018-04-01'
  AND DATE(timestamp, 'Asia/Tokyo') < '2018-12-01'
;

結果
bigquery_result.PNG

13
5
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
13
5