【问题标题】:CURRENT_DATE in BigQuery result to yesterday's dateBigQuery 结果中的 CURRENT_DATE 到昨天的日期
【发布时间】:2020-08-20 21:48:47
【问题描述】:
我试图在我的 BQ 查询中使用 current_date 函数来验证今天的数据,但它不起作用。调试后发现这个函数返回的是昨天的数据。
很遗憾,我无法在此处添加屏幕截图。
下面是我运行的查询
选择 current_date 作为 the_date
结果 = 2020-08-20
应该是2020-08-21
知道如何解决这个问题或如何在大查询中获取当前日期
【问题讨论】:
标签:
google-cloud-platform
google-bigquery
【解决方案1】:
如果您不指定时区,它会为您的项目使用默认时区。我猜你的默认配置有误。
运行这些查询会返回不同的结果。
select current_date('US/Pacific') as the_date
select current_date('Australia/Melbourne') as the_date
允许的时区值为here,以及如何使用current_date()。