I have a string that is a date and it is in M/D/YYYY ie:
1/1/2018
12/31/2018
I get an invalid date error ( it shows: '2/18/2018' as the invalid date)
Any ideas?
Below is example for BigQuery Standard SQL
#standardSQL
WITH `project.dataset.table` AS (
SELECT '1/1/2018' date_as_string UNION ALL
SELECT '12/31/2018'
)
SELECT PARSE_DATE('%m/%d/%Y', date_as_string) date_as_date
FROM `project.dataset.table`
with output:
Row date_as_date
1 2018-01-01
2 2018-12-31
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With