01 Feb 21 · DataFreak · #bigquery ·   Bookmark   ×

Convert DATETIME format to custom display format in BigQuery

Solution:

use FORMAT_DATETIME function:

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

Result

Row cust_dt  
1   2021-08-16 11:00     

DataFreak

posted on 01 Feb 21

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