N1QL查询添加小时和分钟
N1QL query add hours and minutes
我想在 N1QL 中一次添加 5 小时 30 分钟。我该怎么做 ?
我有时间喜欢2016-04-03T18:30:00.000Z
我需要添加5:30。
您可以使用 DATE_ADD_STR(expression, n, part)
日期函数。您的查询类似于以下内容:
SELECT
DATE_ADD_STR(DATE_ADD_STR(old_time, 5, "hour"), 30, "minute") AS new_time, ...
FROM some_bucket
文档:
Performs date arithmetic. n and part are used to define an interval or
duration, which is then added (or subtracted) to the date string in a
supported format, returning the result. Parts:
- "millennium"
- "century"
- "decade"
- "year"
- "quarter"
- "month"
- "week"
- "day"
- "hour"
- "minute"
- "second"
- "millisecond"
来源:http://developer.couchbase.com/documentation/server/4.5/n1ql/n1ql-language-reference/datefun.html
我想在 N1QL 中一次添加 5 小时 30 分钟。我该怎么做 ?
我有时间喜欢2016-04-03T18:30:00.000Z
我需要添加5:30。
您可以使用 DATE_ADD_STR(expression, n, part)
日期函数。您的查询类似于以下内容:
SELECT
DATE_ADD_STR(DATE_ADD_STR(old_time, 5, "hour"), 30, "minute") AS new_time, ...
FROM some_bucket
文档:
Performs date arithmetic. n and part are used to define an interval or duration, which is then added (or subtracted) to the date string in a supported format, returning the result. Parts:
- "millennium"
- "century"
- "decade"
- "year"
- "quarter"
- "month"
- "week"
- "day"
- "hour"
- "minute"
- "second"
- "millisecond"
来源:http://developer.couchbase.com/documentation/server/4.5/n1ql/n1ql-language-reference/datefun.html