How to select format date?


My date in couchbase is following format.
"$1": “2016-08-09 17:00:00”

But I hope I can select date back as “2016-08-09”.

How to add format for the following N1ql?
Select date from table

I tried



Good question. We need to add a simple function for converting dates. For now, you have two options.

(1) Substring. SUBSTR()

(2) MILLIS_TO_STR( MILLIS( your_date ), fmt ).

The fmt must be one of the exact dates in the N1QL reference.