Google-Bigquery

Google Big Query 時區無效:+0000

  • August 29, 2020

得到錯誤

Query Failed
Error: Invalid time zone: +0000

有沒有辦法忽略時區或將所有內容預設為 UCT 這是我的條件

WHERE TIMESTAMP(FORMAT_TIMESTAMP("%Y-%m-%d %H:%M:%E6S%z", PARSE_TIMESTAMP("%Y%m%d", date )),"UCT") = TIMESTAMP('2018-03-05 00:00',"UCT")

date列是這種格式的字元串 20180307

最初由提問者留下的社區 wiki 答案作為評論

修復是從FORMAT_TIMESTAMP

TIMESTAMP(FORMAT_TIMESTAMP("%Y-%m-%d", PARSE_TIMESTAMP("%Y%m%d", ga.date )))

您正在指定UCT,一個無效的時區,因為它是拼寫錯誤。您要查找的時區是UTC.

不正確:

... TIMESTAMP('2018-03-05 00:00',"UCT")

正確的:

... TIMESTAMP('2018-03-05 00:00',"UTC")

引用自:https://dba.stackexchange.com/questions/199588