How to update existing date:"20/12/2020" to milliseconds in couchbase document

How to update date:“20/12/2020” to milliseconds in couchbase existing document

Assume your day, month always 2 digit and year 4 digit. If not you must use some other way covert those first.

UPDATE  default AS d
SET d.date =  MILLIS(SUBSTR(date,6,4)||"-"||SUBSTR(date,3,2)||"-"||SUBSTR(date,0,2))
1 Like

How to convert “mm/dd/yyyy” to milliseconds
date: “12/31/2020”

is there any couchbase function like this?

select DATE_TO_MILLIS(date)

first convert to date to ISO 8601 format and use MILLIS()
https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/datefun.html