How to parse and convert string to date in Bigquery
The string value in this column looks like this "20180902". It needs to be converted to a date value in BigQuery
\n\nSolution
Below example shows that if value is really "20180902" as you state it should work
#standardSQL\nWITH `project.dataset.table` AS (\n SELECT '20180902' timeStamp \n)\nSELECT \n `timeStamp`, \n PARSE_DATE('%Y%m%d', timeStamp ) AS date \nFROM `project.dataset.table`\n
\n\nResult:
\n\nRow timeStamp date \n1 20180902 2018-09-02
victor
posted onEnjoy 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
Post Comment