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 class
DateFunctions.DatePart
static class
DateFunctions.DatePartExt
-
Constructor Summary
Constructors Constructor Description DateFunctions()
-
Method Summary
Modifier and Type Method Description static Expression
clockMillis()
Returned expression results in system clock at function evaluation time, as UNIX milliseconds.static Expression
clockStr(String format)
Returned expression results in system clock at function evaluation time, as a string in a supported format.static Expression
dateAddMillis(Expression expression, int n, DateFunctions.DatePart part)
Returned expression performs Date arithmetic, and returns result of computation.static Expression
dateAddMillis(String expression, int n, DateFunctions.DatePart part)
Returned expression performs Date arithmetic, and returns result of computation.static Expression
dateAddStr(Expression expression, int n, DateFunctions.DatePart part)
Returned expression results in Performs Date arithmetic.static Expression
dateAddStr(String expression, int n, DateFunctions.DatePart part)
Returned expression results in Performs Date arithmetic.static Expression
dateDiffMillis(Expression expression1, Expression expression2, DateFunctions.DatePart part)
Returned expression results in Date arithmetic.static Expression
dateDiffMillis(String expression1, String expression2, DateFunctions.DatePart part)
Returned expression results in Date arithmetic.static Expression
dateDiffStr(Expression expression1, Expression expression2, DateFunctions.DatePart part)
Returned expression results in Performs Date arithmetic.static Expression
dateDiffStr(String expression1, String expression2, DateFunctions.DatePart part)
Returned expression results in Performs Date arithmetic.static Expression
datePartMillis(Expression expression, DateFunctions.DatePartExt part)
Returned expression results in Date part as an integer.static Expression
datePartMillis(String expression, DateFunctions.DatePartExt part)
Returned expression results in Date part as an integer.static Expression
datePartStr(Expression expression, DateFunctions.DatePartExt part)
Returned expression results in Date part as an integer.static Expression
datePartStr(String expression, DateFunctions.DatePartExt part)
Returned expression results in Date part as an integer.static Expression
dateTruncMillis(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 Expression
dateTruncMillis(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 Expression
dateTruncStr(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 Expression
dateTruncStr(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 Expression
millis(Expression expression)
Returned expression results in date that has been converted in a supported format to UNIX milliseconds.static Expression
millis(String expression)
Returned expression results in date that has been converted in a supported format to UNIX milliseconds.static Expression
millisToStr(Expression expression, String format)
Returned expression results in the string in the supported format to which the UNIX milliseconds has been converted.static Expression
millisToStr(String expression, String format)
Returned expression results in the string in the supported format to which the UNIX milliseconds has been converted.static Expression
millisToUtc(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 Expression
millisToUtc(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 Expression
millisToZone(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 Expression
millisToZone(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 Expression
nowMillis()
Returned expression results in statement time stamp as UNIX milliseconds; does not vary during a query.static Expression
nowStr(String format)
Returned expression results in statement time stamp as a string in a supported format; does not vary during a query.static Expression
strToMillis(Expression expression)
Returned expression results in date that has been converted in a supported format to UNIX milliseconds.static Expression
strToMillis(String expression)
Returned expression results in date that has been converted in a supported format to UNIX milliseconds.static Expression
strToUtc(Expression expression)
Returned expression results in a conversion of the ISO 8601 time stamp to UTC.static Expression
strToUtc(String expression)
Returned expression results in a conversion of the ISO 8601 time stamp to UTC.static Expression
strToZoneName(Expression expression, String zoneName)
Returned expression results in a conversion of the supported time stamp string to the named time zone.static Expression
strToZoneName(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.
-