String into date format

Hi All

Please suggest how to convert string like 20200917172851 into date format YYYY-MM-DD hh:si:mm?
I tried with substr and other available date function in couchbase…but no luck.

Appreciate for help.

Thanks
Vikas

SELECT
 CONCAT(SUBSTR(date,0,4),"-",SUBSTR(date,4,2),"-",SUBSTR(date,6,2),"T",SUBSTR(date,8,2),":",SUBSTR(date,10,2),":",SUBSTR(date,12))
 LET date = "20200917172851.1234-07:00";
ISO-8601 Format :   "2020-09-17T17:28:51.1234-07:00"