简体   繁体   中英

String to date on GDS / BIGQUERY

halo, i had data that write with -> 27-Sep-2022 | 15:12 how to make it be date on bigquery? i have try formatdate, substr, and parsedate but none can. thank you!

Below example should give you an ideas of your options (at least few of them)

with  your_table as (
  select '27-Sep-2022 | 15:12' col
)
select col, 
  date(parse_datetime('%d-%B-%Y | %H:%M', col)), 
  parse_date('%d-%B-%Y', trim(split(col, '|')[offset(0)]))
from your_table          

with output

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM