在具有两个不同时区的 BigQuery 中解析时间戳

Parsing timestamp in BigQuery with two different timezones

我在解析采用两种不同时区格式的 BigQuery 中的这个日期时间字段时遇到问题。

它存储为一个字符串。时间戳看起来像这些中的任何一个。

DateTime:
Thu Mar 03 2022 18:18:38 GMT+0000 (GMT)
Thu Mar 03 2022 00:04:32 GMT-0800 (Pacific Standard Time)

我想要的:

DateTime:
Thu Mar 03 2022 10:18:38 GMT-0800 (Pacific Standard Time)
Thu Mar 03 2022 00:04:32 GMT-0800 (Pacific Standard Time)

我遇到日期时间错误,parse_timestamp 试图做这样的事情:

parse_timestamp("%a %b %d %E4Y %T", DateTime , 'US/Pacific')

我怎样才能让它工作?

考虑以下选项

select *, 
  datetime(parse_timestamp("%a %b %d %Y %T GMT%Z", regexp_replace(DateTime, r' \([ \w]+\)', '')), 'US/Pacific'),
  format_datetime("%a %b %d %Y %T", datetime(parse_timestamp("%a %b %d %Y %T GMT%Z", regexp_replace(DateTime, r' \([ \w]+\)', '')), 'US/Pacific')), 
from your_table    

如果应用于您问题中的示例数据 - 输出为