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é
  • Constructor Details

    • DateFunctions

      public DateFunctions()
  • Method Details

    • clockMillis

      public static Expression clockMillis()
      Returned expression results in system clock at function evaluation time, as UNIX milliseconds. Varies during a query.
    • clockStr

      public static Expression clockStr​(String format)
      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

      public static Expression dateAddMillis​(Expression expression, int n, DateFunctions.DatePart part)
      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

      public static Expression dateAddMillis​(String expression, int n, DateFunctions.DatePart part)
      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

      public static Expression dateAddStr​(Expression expression, int n, DateFunctions.DatePart part)
      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

      public static Expression dateAddStr​(String expression, int n, DateFunctions.DatePart part)
      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

      public static Expression datePartMillis​(Expression expression, DateFunctions.DatePartExt part)
      Returned expression results in Date part as an integer. The date expression is a number representing UNIX milliseconds, and part is a DateFunctions.DatePartExt.
    • datePartMillis

      public static Expression datePartMillis​(String expression, DateFunctions.DatePartExt part)
      Returned expression results in Date part as an integer. The date expression is a number representing UNIX milliseconds, and part is a DateFunctions.DatePartExt.
    • datePartStr

      public static Expression datePartStr​(Expression expression, DateFunctions.DatePartExt part)
      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

      public static Expression datePartStr​(String expression, DateFunctions.DatePartExt part)
      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

      public 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.
    • dateTruncMillis

      public 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.
    • dateTruncStr

      public 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.
    • dateTruncStr

      public 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.
    • millis

      public static Expression millis​(Expression expression)
      Returned expression results in date that has been converted in a supported format to UNIX milliseconds.
    • millis

      public static Expression millis​(String expression)
      Returned expression results in date that has been converted in a supported format to UNIX milliseconds.
    • strToMillis

      public static Expression strToMillis​(Expression expression)
      Returned expression results in date that has been converted in a supported format to UNIX milliseconds.
    • strToMillis

      public static Expression strToMillis​(String expression)
      Returned expression results in date that has been converted in a supported format to UNIX milliseconds.
    • millisToStr

      public 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.
    • millisToStr

      public 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.
    • millisToUtc

      public 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.
    • millisToUtc

      public 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.
    • millisToZone

      public 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.
    • millisToZone

      public 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.
    • nowMillis

      public static Expression nowMillis()
      Returned expression results in statement time stamp as UNIX milliseconds; does not vary during a query.
    • nowStr

      public 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.
    • strToUtc

      public static Expression strToUtc​(Expression expression)
      Returned expression results in a conversion of the ISO 8601 time stamp to UTC.
    • strToUtc

      public static Expression strToUtc​(String expression)
      Returned expression results in a conversion of the ISO 8601 time stamp to UTC.
    • strToZoneName

      public static Expression strToZoneName​(Expression expression, String zoneName)
      Returned expression results in a conversion of the supported time stamp string to the named time zone.
    • strToZoneName

      public static Expression strToZoneName​(String expression, String zoneName)
      Returned expression results in a conversion of the supported time stamp string to the named time zone.