Oracle 日期函数转换为 BigQuery SQL
Oracle Date Function Translation to BigQuery SQL
需要帮助将此函数从 Oracle 转换为 BigQuery,from_tz 和时间戳格式给我带来麻烦:
trunc(from_tz(to_timestamp(trunc(llc.DATE) || ' ' || llc.HOUR, 'DD-MON-YY HH24MISS'), 'UTC') at time zone 'America/New_York') as the_date
考虑以下方法。我使用 timestamp functions 创建查询。
with sample_data as (
select date('2017-08-04') as date, time(10,00,00) as hour
)
select
format_timestamp( "%d-%b-%y %H%M%S", timestamp_trunc(timestamp(concat(date, ' ',hour),"UTC"),DAY,"America/New_York")) as out_format
from sample_data
注意:我根据您针对问题提出的查询创建了示例数据。如果我使用了不正确的数据,请告诉我,以便我修改答案。
输出:
需要帮助将此函数从 Oracle 转换为 BigQuery,from_tz 和时间戳格式给我带来麻烦:
trunc(from_tz(to_timestamp(trunc(llc.DATE) || ' ' || llc.HOUR, 'DD-MON-YY HH24MISS'), 'UTC') at time zone 'America/New_York') as the_date
考虑以下方法。我使用 timestamp functions 创建查询。
with sample_data as (
select date('2017-08-04') as date, time(10,00,00) as hour
)
select
format_timestamp( "%d-%b-%y %H%M%S", timestamp_trunc(timestamp(concat(date, ' ',hour),"UTC"),DAY,"America/New_York")) as out_format
from sample_data
注意:我根据您针对问题提出的查询创建了示例数据。如果我使用了不正确的数据,请告诉我,以便我修改答案。
输出: