How to cast String into Date in Bigquery with date format MM/DD/YYYY

Use the PARSE_DATE function to cast / convert a string column to DATE value. Check the below example for usage and syntax:

Example:

WITH `project.dataset.table` AS (
  SELECT '1/1/2020' date_as_string UNION ALL
  SELECT '12/31/2020'
)
SELECT PARSE_DATE('%m/%d/%Y', date_as_string) date_as_date
FROM `project.dataset.table`

Output:

Row date_as_date     
1   2020-01-01   
2   2020-12-31   

victor

posted on 01 Dec 20

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds