我们如何在 Bigquery 中将数字转换为 12 小时制 table

How can we convert numbers to 12 hour time format in Bigquery table

我的 bigquery table 有一个格式如下的列

23:00 19:00 15:00

我想将它们转换为时间格式(AM/PM)

11:00 下午 07:00下午 03:00下午

提前致谢!!

使用parse_time and format_time:

select format_time('%I:%M %p', parse_time('%H:%M', '23:00'))

尝试:

with mytable as (
  select '23:00' as column1 union all
  select '19:00' as column1 union all
  select '15:00' as column1
)
select format_time('%I:%M %p', parse_time('%H:%M', column1))
from mytable