Convert DATETIME format to custom display format in BigQuery

Solution:

use FORMAT_DATETIME function:

\n\n
#standardSQL\nWITH `project.dataset.table` AS (\n  SELECT DATETIME '2021-08-16T11:00:35.683000' dt\n)\nSELECT FORMAT_DATETIME('%Y-%m-%d %R', dt) cust_dt\nFROM `project.dataset.table`  \n
\n\n

Result

\n\n
Row cust_dt  \n1   2021-08-16 11:00     \n

DataFreak

posted on

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