BigQuery-选择时间戳记作为人类可读的日期时间 [英] Bigquery - select timestamp as human readable datetime
本文介绍了BigQuery-选择时间戳记作为人类可读的日期时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Google Bigquery中选择时间戳(以秒为单位存储)作为人类可读的日期时间?
How to select timestamp(stored as seconds) as human readable datetime in Google Bigquery?
模式
id(STRING) | signup_date(TIMESTAMP)
我使用DATE
函数编写了一个查询,但出现错误
I wrote a query using DATE
function, but getting error
SELECT DATE(create_date) FROM [accounts]
错误:无效的函数名称:DATE;你是说CASE吗?
Error: Invalid function name: DATE; did you mean CASE?
谢谢!
推荐答案
我认为我从Bigquery参考页上找到了可行的解决方案.基本上,BigQuery在内部将TIMESTAMP
数据存储为UNIX timestamp
,且精度为微秒.
I think I found a working solution from Bigquery reference page. Basically BigQuery stores TIMESTAMP
data internally as a UNIX timestamp
with microsecond precision.
SELECT SEC_TO_TIMESTAMP(date) FROM ...
这篇关于BigQuery-选择时间戳记作为人类可读的日期时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文