Class DateFunctions
java.lang.Object
com.couchbase.client.java.query.dsl.functions.DateFunctions
@Experimental @Public public class DateFunctions extends Object
DSL for N1QL functions in the Date category.
Date functions return the system clock value or manipulate the date string.
- Since:
- 2.2
- Author:
- Simon Baslé
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDateFunctions.DatePartstatic classDateFunctions.DatePartExt -
Constructor Summary
Constructors Constructor Description DateFunctions() -
Method Summary
Modifier and Type Method Description static ExpressionclockMillis()Returned expression results in system clock at function evaluation time, as UNIX milliseconds.static ExpressionclockStr(String format)Returned expression results in system clock at function evaluation time, as a string in a supported format.static ExpressiondateAddMillis(Expression expression, int n, DateFunctions.DatePart part)Returned expression performs Date arithmetic, and returns result of computation.static ExpressiondateAddMillis(String expression, int n, DateFunctions.DatePart part)Returned expression performs Date arithmetic, and returns result of computation.static ExpressiondateAddStr(Expression expression, int n, DateFunctions.DatePart part)Returned expression results in Performs Date arithmetic.static ExpressiondateAddStr(String expression, int n, DateFunctions.DatePart part)Returned expression results in Performs Date arithmetic.static ExpressiondateDiffMillis(Expression expression1, Expression expression2, DateFunctions.DatePart part)Returned expression results in Date arithmetic.static ExpressiondateDiffMillis(String expression1, String expression2, DateFunctions.DatePart part)Returned expression results in Date arithmetic.static ExpressiondateDiffStr(Expression expression1, Expression expression2, DateFunctions.DatePart part)Returned expression results in Performs Date arithmetic.static ExpressiondateDiffStr(String expression1, String expression2, DateFunctions.DatePart part)Returned expression results in Performs Date arithmetic.static ExpressiondatePartMillis(Expression expression, DateFunctions.DatePartExt part)Returned expression results in Date part as an integer.static ExpressiondatePartMillis(String expression, DateFunctions.DatePartExt part)Returned expression results in Date part as an integer.static ExpressiondatePartStr(Expression expression, DateFunctions.DatePartExt part)Returned expression results in Date part as an integer.static ExpressiondatePartStr(String expression, DateFunctions.DatePartExt part)Returned expression results in Date part as an integer.static ExpressiondateTruncMillis(Expression expression, DateFunctions.DatePart part)Returned expression results in UNIX timestamp that has been truncated so that the given date part is the least significant.static ExpressiondateTruncMillis(String expression, DateFunctions.DatePart part)Returned expression results in UNIX timestamp that has been truncated so that the given date part is the least significant.static ExpressiondateTruncStr(Expression expression, DateFunctions.DatePart part)Returned expression results in ISO 8601 timestamp that has been truncated so that the given date part is the least significant.static ExpressiondateTruncStr(String expression, DateFunctions.DatePart part)Returned expression results in ISO 8601 timestamp that has been truncated so that the given date part is the least significant.static Expressionmillis(Expression expression)Returned expression results in date that has been converted in a supported format to UNIX milliseconds.static Expressionmillis(String expression)Returned expression results in date that has been converted in a supported format to UNIX milliseconds.static ExpressionmillisToStr(Expression expression, String format)Returned expression results in the string in the supported format to which the UNIX milliseconds has been converted.static ExpressionmillisToStr(String expression, String format)Returned expression results in the string in the supported format to which the UNIX milliseconds has been converted.static ExpressionmillisToUtc(Expression expression, String format)Returned expression results in the UTC string to which the UNIX time stamp has been converted in the supported format.static ExpressionmillisToUtc(String expression, String format)Returned expression results in the UTC string to which the UNIX time stamp has been converted in the supported format.static ExpressionmillisToZone(Expression expression, String timeZoneName, String format)Returned expression results in a convertion of the UNIX time stamp to a string in the named time zone.static ExpressionmillisToZone(String expression, String timeZoneName, String format)Returned expression results in a convertion of the UNIX time stamp to a string in the named time zone.static ExpressionnowMillis()Returned expression results in statement time stamp as UNIX milliseconds; does not vary during a query.static ExpressionnowStr(String format)Returned expression results in statement time stamp as a string in a supported format; does not vary during a query.static ExpressionstrToMillis(Expression expression)Returned expression results in date that has been converted in a supported format to UNIX milliseconds.static ExpressionstrToMillis(String expression)Returned expression results in date that has been converted in a supported format to UNIX milliseconds.static ExpressionstrToUtc(Expression expression)Returned expression results in a conversion of the ISO 8601 time stamp to UTC.static ExpressionstrToUtc(String expression)Returned expression results in a conversion of the ISO 8601 time stamp to UTC.static ExpressionstrToZoneName(Expression expression, String zoneName)Returned expression results in a conversion of the supported time stamp string to the named time zone.static ExpressionstrToZoneName(String expression, String zoneName)Returned expression results in a conversion of the supported time stamp string to the named time zone.
-
Constructor Details
-
DateFunctions
public DateFunctions()
-
-
Method Details
-
clockMillis
Returned expression results in system clock at function evaluation time, as UNIX milliseconds. Varies during a query. -
clockStr
Returned expression results in system clock at function evaluation time, as a string in a supported format. Varies during a query. Supported formats: - "2006-01-02T15:04:05.999Z07:00": Default format. (ISO8601 / RFC3339) - "2006-01-02T15:04:05Z07:00" (ISO8601 / RFC3339) - "2006-01-02T15:04:05.999" - "2006-01-02T15:04:05" - "2006-01-02 15:04:05.999Z07:00" - "2006-01-02 15:04:05Z07:00" - "2006-01-02 15:04:05.999" - "2006-01-02 15:04:05" - "2006-01-02" - "15:04:05.999Z07:00" - "15:04:05Z07:00" - "15:04:05.999" - "15:04:05" -
dateAddMillis
Returned expression performs Date arithmetic, and returns result of computation. n and part are used to define an interval or duration, which is then added (or subtracted) to the UNIX timestamp, returning the result. -
dateAddMillis
Returned expression performs Date arithmetic, and returns result of computation. n and part are used to define an interval or duration, which is then added (or subtracted) to the UNIX timestamp, returning the result. -
dateAddStr
Returned expression results in 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. -
dateAddStr
Returned expression results in 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. -
dateDiffMillis
public static Expression dateDiffMillis(Expression expression1, Expression expression2, DateFunctions.DatePart part)Returned expression results in Date arithmetic. Returns the elapsed time between two UNIX timestamps as an integer whose unit is part. -
dateDiffMillis
public static Expression dateDiffMillis(String expression1, String expression2, DateFunctions.DatePart part)Returned expression results in Date arithmetic. Returns the elapsed time between two UNIX timestamps as an integer whose unit is part. -
dateDiffStr
public static Expression dateDiffStr(Expression expression1, Expression expression2, DateFunctions.DatePart part)Returned expression results in Performs Date arithmetic. Returns the elapsed time between two date strings in a supported format, as an integer whose unit is part. -
dateDiffStr
public static Expression dateDiffStr(String expression1, String expression2, DateFunctions.DatePart part)Returned expression results in Performs Date arithmetic. Returns the elapsed time between two date strings in a supported format, as an integer whose unit is part. -
datePartMillis
Returned expression results in Date part as an integer. The date expression is a number representing UNIX milliseconds, and part is aDateFunctions.DatePartExt. -
datePartMillis
Returned expression results in Date part as an integer. The date expression is a number representing UNIX milliseconds, and part is aDateFunctions.DatePartExt. -
datePartStr
Returned expression results in Date part as an integer. The date expression is a string in a supported format, and part is one of the supported date part strings. -
datePartStr
Returned expression results in Date part as an integer. The date expression is a string in a supported format, and part is one of the supported date part strings. -
dateTruncMillis
Returned expression results in UNIX timestamp that has been truncated so that the given date part is the least significant. -
dateTruncMillis
Returned expression results in UNIX timestamp that has been truncated so that the given date part is the least significant. -
dateTruncStr
Returned expression results in ISO 8601 timestamp that has been truncated so that the given date part is the least significant. -
dateTruncStr
Returned expression results in ISO 8601 timestamp that has been truncated so that the given date part is the least significant. -
millis
Returned expression results in date that has been converted in a supported format to UNIX milliseconds. -
millis
Returned expression results in date that has been converted in a supported format to UNIX milliseconds. -
strToMillis
Returned expression results in date that has been converted in a supported format to UNIX milliseconds. -
strToMillis
Returned expression results in date that has been converted in a supported format to UNIX milliseconds. -
millisToStr
Returned expression results in the string in the supported format to which the UNIX milliseconds has been converted. -
millisToStr
Returned expression results in the string in the supported format to which the UNIX milliseconds has been converted. -
millisToUtc
Returned expression results in the UTC string to which the UNIX time stamp has been converted in the supported format. -
millisToUtc
Returned expression results in the UTC string to which the UNIX time stamp has been converted in the supported format. -
millisToZone
Returned expression results in a convertion of the UNIX time stamp to a string in the named time zone. -
millisToZone
Returned expression results in a convertion of the UNIX time stamp to a string in the named time zone. -
nowMillis
Returned expression results in statement time stamp as UNIX milliseconds; does not vary during a query. -
nowStr
Returned expression results in statement time stamp as a string in a supported format; does not vary during a query. -
strToUtc
Returned expression results in a conversion of the ISO 8601 time stamp to UTC. -
strToUtc
Returned expression results in a conversion of the ISO 8601 time stamp to UTC. -
strToZoneName
Returned expression results in a conversion of the supported time stamp string to the named time zone. -
strToZoneName
Returned expression results in a conversion of the supported time stamp string to the named time zone.
-