How to select format date?


#1

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

Thanks


#2

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.

http://developer.couchbase.com/documentation/server/4.5/n1ql/n1ql-language-reference/datefun.html