I'm trying to convert a string into timestamp format in BigQuery.
The source has all dates in the format "10/15 11:59 PM".
Here's what I'm trying as a proof of concept:
SELECT
PARSE_TIMESTAMP(
'%d/%m/%y %I:%M %p',
CONCAT(SPLIT('10/15 5:00 PM', ' ')[offset(0)]
,'/',FORMAT_DATE('%y',CURRENT_DATE()),' '
,SPLIT('10/15 5:00 PM', ' ')[offset(1)],' '
,SPLIT('10/15 5:00 PM', ' ')[offset(2)]
)
)
The string this generates is "10/15/18 5:00 PM" which looks correct to me, but when I run it I get the error:
Query Failed Error: Failed to parse input string "10/15/18 5:00 PM"
Any ideas what else I could try to get this formatted as a timestamp?
Thanks!