LoginSignup
0

More than 5 years have passed since last update.

【Bigquery】文字列型の日付を0埋めした形でいい感じに日付型に変換する方法

Posted at

とあるテーブルの日付を入れるカラムに

2015/2/19 
こういうやつとか
2015/05/03
こういう形式で日付(文字列型)が入っちゃってるときに、いい感じに、
2015/02/19 

みたいに変換する方法です。

SELECT
    PARSE_DATE('%Y/%m/%d', '2018/5/1') AS _date

これで、
2018-05-01
という日付がDATE型で返ってくるのであとはよしなに色々できます。

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
0