Parsing string date to date format

Viewed 61

I'm having issues parsing a string to a date format.

This is my string 7/13/2022 9:46 AM

As per the documentation, I'm trying PARSE_DATETIME("%x %R %p", datetime_closed) or PARSE_DATETIME("%D %E4Y %R %p", "7/13/2022 9:46 AM")

I've tried other combinations but none of them works

2 Answers

Use PARSE_DATETIME("%m/%d/%Y %l:%M %p", datetime_closed) to get datetime or DATE(PARSE_DATETIME("%m/%d/%Y %l:%M %p", datetime_closed)) to get date

You can use the format below:

PARSE_DATETIME('%m/%d/%Y %l:%M %p', "7/13/2022 9:46 AM")

The output:

parse_datetime_output

Related