BigQuery将UTC时间转换为本地时间 [英] BigQuery Converting UTC Time to Local time

查看:124
本文介绍了BigQuery将UTC时间转换为本地时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有人知道某种方法或具有将BigQuery UTC时间戳自动转换为本地标准时间或夏时制(在我的情况下为PDT/PST)的功能.

I was wondering if anybody knows a way or has a function that automatically converts a BigQuery UTC timestamp to a local Standard or Daylight saving timezone (PDT/PST in my case).

基本上会根据一年中的时间自动从UTC扣除7或8个小时以得出PDT或PST.

Basically automatically deducting 7 or 8 hours from UTC to give PDT or PST based on the time of the year.

我知道有很多方法可以实现此目的,但是我想知道是否有人知道BigQuery环境中的任何简单,干净和快速的方法.

I know there are many ways I could implement this but I was wondering if anybody knew of any easy, clean and quick way in BigQuery environment.

谢谢

推荐答案

使用标准SQL (截至2016年9月),您可以访问时区功能,例如 DATE(timestamp_expression [,timezone]):

Using standard SQL (as of sep 2016) you have access to timezone functions such as DATE(timestamp_expression[, timezone]):

#standardSQL
SELECT DATETIME("2008-12-25 15:30:00+07", "America/Los_Angeles") as date;

文档位于此处.

这篇关于BigQuery将UTC时间转换为本地时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆