BIGQUERY 中的 STRING 日期
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44564887/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
STRING to DATE in BIGQUERY
提问by Lucasaudati11
I am struggling trying to do this with Google BigQuery:
我正在努力尝试使用 Google BigQuery 做到这一点:
I do have a column with dates in this following STRING format:
我确实有一列包含以下 STRING 格式的日期:
6/9/2017 (M/D/YYYY)
I am wondering how can I deal with this, trying to use then the DATE clause., in order to get the DATE format:
我想知道如何处理这个问题,然后尝试使用 DATE 子句,以获得 DATE 格式:
YYYY-MM-DD.
YYYY-MM-DD。
Thanks in advance.
提前致谢。
回答by Felipe Hoffa
Easy one, with standard SQL:
简单的一个,使用标准 SQL:
#standardSQL
SELECT PARSE_DATE('%m/%d/%Y', '6/22/2017')
2017-06-22