Class BusinessCalendar

java.lang.Object
io.deephaven.time.calendar.Calendar
io.deephaven.time.calendar.BusinessCalendar

public class BusinessCalendar extends Calendar
A business calendar, with the concept of business and non-business time.

Date strings must be in a format that can be parsed by DateTimeUtils#parseDate. Methods that accept strings can be slower than methods written explicitly for Instant, ZonedDateTime, or LocalDate.

  • Constructor Details

    • BusinessCalendar

      public BusinessCalendar(String name, String description, ZoneId timeZone, LocalDate firstValidDate, LocalDate lastValidDate, CalendarDay<LocalTime> standardBusinessDay, Set<DayOfWeek> weekendDays, Map<LocalDate,CalendarDay<Instant>> holidays)
      Creates a new business calendar.
      Parameters:
      name - calendar name.
      description - calendar description.
      timeZone - calendar time zone.
      firstValidDate - first valid date for the business calendar.
      lastValidDate - last valid date for the business calendar.
      standardBusinessDay - business day schedule for a standard business day
      weekendDays - weekend days
      holidays - holidays. Business day schedules for all holidays. A holiday is a date that has a schedule that is different from the schedule for a standard business day or weekend.
      Throws:
      RequirementFailure - if any argument is null.
  • Method Details

    • firstValidDate

      public LocalDate firstValidDate()
      Returns the first valid date for the business calendar.
      Returns:
      first valid date for the business calendar.
    • lastValidDate

      public LocalDate lastValidDate()
      Returns the last valid date for the business calendar.
      Returns:
      last valid date for the business calendar.
    • weekendDays

      public Set<DayOfWeek> weekendDays()
      Returns the days that make up a weekend.
      Returns:
      days that make up a weekend.
    • standardBusinessDay

      public CalendarDay<LocalTime> standardBusinessDay()
      Business day schedule for a standard business day.
      Returns:
      business day schedule for a standard business day.
    • standardBusinessNanos

      public long standardBusinessNanos()
      Length of a standard business day in nanoseconds.
      Returns:
      length of a standard business day in nanoseconds
    • standardBusinessDuration

      public Duration standardBusinessDuration()
      Length of a standard business day.
      Returns:
      length of a standard business day
    • holidays

      public Map<LocalDate,CalendarDay<Instant>> holidays()
      Business day schedules for all holidays. A holiday is a date that has a schedule that is different from the schedule for a standard business day or weekend.
      Returns:
      a map of holiday dates and their calendar days
    • calendarDay

      public CalendarDay<Instant> calendarDay(LocalDate date)
      Returns the CalendarDay for a date.
      Parameters:
      date - date
      Returns:
      the corresponding CalendarDay of date. null if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • calendarDay

      public CalendarDay<Instant> calendarDay(ZonedDateTime time)
      Returns the CalendarDay for a date.
      Parameters:
      time - time
      Returns:
      the corresponding CalendarDay of date. null if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • calendarDay

      public CalendarDay<Instant> calendarDay(Instant time)
      Returns the CalendarDay for a date.
      Parameters:
      time - time
      Returns:
      the corresponding CalendarDay of date. null if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • calendarDay

      public CalendarDay<Instant> calendarDay(String date)
      Returns the CalendarDay for a date.
      Parameters:
      date - date
      Returns:
      the corresponding CalendarDay of date. null if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • calendarDay

      public CalendarDay<Instant> calendarDay()
      Returns the CalendarDay for a date.
      Returns:
      today's business day schedule
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isBusinessDay

      public boolean isBusinessDay(LocalDate date)
      Is the date a business day?
      Parameters:
      date - date
      Returns:
      true if the date is a business day; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isBusinessDay

      public boolean isBusinessDay(String date)
      Is the date a business day?
      Parameters:
      date - date
      Returns:
      true if the date is a business day; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • isBusinessDay

      public boolean isBusinessDay(ZonedDateTime time)
      Is the time on a business day? As long as the time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule. To determine if a time is within the business day schedule, use isBusinessTime(ZonedDateTime).
      Parameters:
      time - time
      Returns:
      true if the date is a business day; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isBusinessDay

      public boolean isBusinessDay(Instant time)
      Is the time on a business day? As long as the time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule. To determine if a time is within the business day schedule, use isBusinessTime(Instant).
      Parameters:
      time - time
      Returns:
      true if the date is a business day; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isBusinessDay

      public boolean isBusinessDay(DayOfWeek day)
      Is the day of the week a normal business day?
      Parameters:
      day - a day of the week
      Returns:
      true if the day is a business day; false otherwise. False if the input is null.
    • isBusinessDay

      public boolean isBusinessDay()
      Is the current day a business day? As long as the current time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule.
      Returns:
      true if the current day is a business day; false otherwise
    • isLastBusinessDayOfMonth

      public boolean isLastBusinessDayOfMonth(ZonedDateTime time)
      Is the time on the last business day of the month? As long as the time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule.
      Parameters:
      time - time
      Returns:
      true if time is on the last business day of the month; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isLastBusinessDayOfMonth

      public boolean isLastBusinessDayOfMonth(Instant time)
      Is the time on the last business day of the month? As long as the time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule.
      Parameters:
      time - time
      Returns:
      true if time is on the last business day of the month; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isLastBusinessDayOfMonth

      public boolean isLastBusinessDayOfMonth(String date)
      Is the date the last business day of the month?
      Parameters:
      date - date
      Returns:
      true if time is on the last business day of the month; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • isLastBusinessDayOfMonth

      public boolean isLastBusinessDayOfMonth()
      Is the current date the last business day of the month?
      Returns:
      true if the current date is the last business day of the month; false otherwise.
    • isLastBusinessDayOfWeek

      public boolean isLastBusinessDayOfWeek(LocalDate date)
      Is the date the last business day of the week?
      Parameters:
      date - date
      Returns:
      true if date is on the last business day of the week; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isLastBusinessDayOfWeek

      public boolean isLastBusinessDayOfWeek(ZonedDateTime time)
      Is the time on the last business day of the week? As long as the time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule.
      Parameters:
      time - time
      Returns:
      true if time is on the last business day of the week; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isLastBusinessDayOfWeek

      public boolean isLastBusinessDayOfWeek(Instant time)
      Is the time on the last business day of the week? As long as the time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule.
      Parameters:
      time - time
      Returns:
      true if time is on the last business day of the week; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isLastBusinessDayOfWeek

      public boolean isLastBusinessDayOfWeek(String date)
      Is the date is last business day of the week?
      Parameters:
      date - date
      Returns:
      true if date is the last business day of the week; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • isLastBusinessDayOfWeek

      public boolean isLastBusinessDayOfWeek()
      Is the current date the last business day of the week?
      Returns:
      true if the current date is the last business day of the week; false otherwise.
    • isLastBusinessDayOfYear

      public boolean isLastBusinessDayOfYear(ZonedDateTime time)
      Is the time on the last business day of the year? As long as the time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule.
      Parameters:
      time - time
      Returns:
      true if time is on the last business day of the year; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isLastBusinessDayOfYear

      public boolean isLastBusinessDayOfYear(Instant time)
      Is the time on the last business day of the year? As long as the time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule.
      Parameters:
      time - time
      Returns:
      true if time is on the last business day of the year; false otherwise. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isLastBusinessDayOfYear

      public boolean isLastBusinessDayOfYear()
      Is the current date the last business day of the year? As long as the current time occurs on a business day, it is considered a business day. The time does not have to be within the business day schedule.
      Returns:
      true if the current date is the last business day of the year; false otherwise.
    • isBusinessTime

      public boolean isBusinessTime(ZonedDateTime time)
      Determines if the specified time is a business time. Business times fall within business time ranges of the day's business schedule.
      Parameters:
      time - time
      Returns:
      true if the specified time is a business time; otherwise, false. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isBusinessTime

      public boolean isBusinessTime(Instant time)
      Determines if the specified time is a business time. Business times fall within business time ranges of the day's business schedule.
      Parameters:
      time - time
      Returns:
      true if the specified time is a business time; otherwise, false. False if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • isBusinessTime

      public boolean isBusinessTime()
      Determines if the current time according to the Deephaven system clock is a business time. Business times fall within business time ranges of the day's business schedule.
      Returns:
      true if the specified time is a business time; otherwise, false.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionStandardBusinessDay

      public double fractionStandardBusinessDay(LocalDate date)
      Returns the ratio of the business day length and the standard business day length. For example, a holiday has zero business time and will therefore return 0.0. A normal business day will be of the standard length and will therefore return 1.0. A NYSE half day holiday will return 0.538 (3.5 hours open, over a standard 6.5 hour day).
      Parameters:
      date - date
      Returns:
      ratio of the business day length and the standard business day length for the date. QueryConstants.NULL_DOUBLE if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionStandardBusinessDay

      public double fractionStandardBusinessDay(String date)
      Returns the ratio of the business day length and the standard business day length. For example, a holiday has zero business time and will therefore return 0.0. A normal business day will be of the standard length and will therefore return 1.0. A half day holiday will return 0.5.
      Parameters:
      date - date
      Returns:
      ratio of the business day length and the standard business day length for the date. QueryConstants.NULL_DOUBLE if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • fractionStandardBusinessDay

      public double fractionStandardBusinessDay(Instant time)
      Returns the ratio of the business day length and the standard business day length. For example, a holiday has zero business time and will therefore return 0.0. A normal business day will be of the standard length and will therefore return 1.0. A half day holiday will return 0.5.
      Parameters:
      time - time
      Returns:
      ratio of the business day length and the standard business day length for the date. QueryConstants.NULL_DOUBLE if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionStandardBusinessDay

      public double fractionStandardBusinessDay(ZonedDateTime time)
      Returns the ratio of the business day length and the standard business day length. For example, a holiday has zero business time and will therefore return 0.0. A normal business day will be of the standard length and will therefore return 1.0. A half day holiday will return 0.5.
      Parameters:
      time - time
      Returns:
      ratio of the business day length and the standard business day length for the date. QueryConstants.NULL_DOUBLE if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionStandardBusinessDay

      public double fractionStandardBusinessDay()
      Returns the ratio of the business day length and the standard business day length. For example, a holiday has zero business time and will therefore return 0.0. A normal business day will be of the standard length and will therefore return 1.0. A half day holiday will return 0.5.
      Returns:
      ratio of the business day length and the standard business day length for the date
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionBusinessDayComplete

      public double fractionBusinessDayComplete(Instant time)
      Fraction of the business day complete.
      Parameters:
      time - time
      Returns:
      the fraction of the business day complete, or 1.0 if the day is not a business day. QueryConstants.NULL_DOUBLE if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionBusinessDayComplete

      public double fractionBusinessDayComplete(ZonedDateTime time)
      Fraction of the business day complete.
      Parameters:
      time - time
      Returns:
      the fraction of the business day complete, or 1.0 if the day is not a business day. QueryConstants.NULL_DOUBLE if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionBusinessDayComplete

      public double fractionBusinessDayComplete()
      Fraction of the current business day complete.
      Returns:
      the fraction of the business day complete, or 1.0 if the day is not a business day
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionBusinessDayRemaining

      public double fractionBusinessDayRemaining(Instant time)
      Fraction of the business day remaining.
      Parameters:
      time - time
      Returns:
      the fraction of the business day complete, or 0.0 if the day is not a business day.QueryConstants.NULL_DOUBLE if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionBusinessDayRemaining

      public double fractionBusinessDayRemaining(ZonedDateTime time)
      Fraction of the business day remaining.
      Parameters:
      time - time
      Returns:
      the fraction of the business day complete, or 0.0 if the day is not a business day. QueryConstants.NULL_DOUBLE if the input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • fractionBusinessDayRemaining

      public double fractionBusinessDayRemaining()
      Fraction of the business day remaining.
      Returns:
      the fraction of the business day complete, or 0.0 if the day is not a business day
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • numberBusinessDates

      public int numberBusinessDates(LocalDate start, LocalDate end, boolean startInclusive, boolean endInclusive)
      Returns the number of business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      number of business dates between start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberBusinessDates

      public int numberBusinessDates(String start, String end, boolean startInclusive, boolean endInclusive)
      Returns the number of business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      number of business dates between start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • numberBusinessDates

      public int numberBusinessDates(ZonedDateTime start, ZonedDateTime end, boolean startInclusive, boolean endInclusive)
      Returns the number of business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      number of business dates between start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberBusinessDates

      public int numberBusinessDates(Instant start, Instant end, boolean startInclusive, boolean endInclusive)
      Returns the number of business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      number of business dates between start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberBusinessDates

      public int numberBusinessDates(LocalDate start, LocalDate end)
      Returns the number of business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      number of business dates between start and end; including start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberBusinessDates

      public int numberBusinessDates(String start, String end)
      Returns the number of business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      number of business dates between start and end; including start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • numberBusinessDates

      public int numberBusinessDates(ZonedDateTime start, ZonedDateTime end)
      Returns the number of business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      number of business dates between start and end; including start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberBusinessDates

      public int numberBusinessDates(Instant start, Instant end)
      Returns the number of business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      number of business dates between start and end; including start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberNonBusinessDates

      public int numberNonBusinessDates(LocalDate start, LocalDate end, boolean startInclusive, boolean endInclusive)
      Returns the number of non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      number of non-business dates between start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberNonBusinessDates

      public int numberNonBusinessDates(String start, String end, boolean startInclusive, boolean endInclusive)
      Returns the number of non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      number of non-business dates between start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • numberNonBusinessDates

      public int numberNonBusinessDates(ZonedDateTime start, ZonedDateTime end, boolean startInclusive, boolean endInclusive)
      Returns the number of non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      number of non-business dates between start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberNonBusinessDates

      public int numberNonBusinessDates(Instant start, Instant end, boolean startInclusive, boolean endInclusive)
      Returns the number of non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      number of non-business dates between start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberNonBusinessDates

      public int numberNonBusinessDates(LocalDate start, LocalDate end)
      Returns the number of non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      number of non-business dates between start and end; including start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberNonBusinessDates

      public int numberNonBusinessDates(String start, String end)
      Returns the number of non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      number of non-business dates between start and end; including start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • numberNonBusinessDates

      public int numberNonBusinessDates(ZonedDateTime start, ZonedDateTime end)
      Returns the number of non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      number of non-business dates between start and end; including start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • numberNonBusinessDates

      public int numberNonBusinessDates(Instant start, Instant end)
      Returns the number of non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      number of non-business dates between start and end; including start and end. QueryConstants.NULL_INT if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • businessDates

      public LocalDate[] businessDates(LocalDate start, LocalDate end, boolean startInclusive, boolean endInclusive)
      Returns the business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      business dates between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • businessDates

      public String[] businessDates(String start, String end, boolean startInclusive, boolean endInclusive)
      Returns the business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      business dates between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • businessDates

      public LocalDate[] businessDates(ZonedDateTime start, ZonedDateTime end, boolean startInclusive, boolean endInclusive)
      Returns the business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      business dates between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • businessDates

      public LocalDate[] businessDates(Instant start, Instant end, boolean startInclusive, boolean endInclusive)
      Returns the business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      business dates between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • businessDates

      public LocalDate[] businessDates(LocalDate start, LocalDate end)
      Returns the business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      business dates between start and end; including start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • businessDates

      public String[] businessDates(String start, String end)
      Returns the business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      business dates between start and end; including start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • businessDates

      public LocalDate[] businessDates(ZonedDateTime start, ZonedDateTime end)
      Returns the business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      business dates between start and end; including start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • businessDates

      public LocalDate[] businessDates(Instant start, Instant end)
      Returns the business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      business dates between start and end; including start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • nonBusinessDates

      public LocalDate[] nonBusinessDates(LocalDate start, LocalDate end, boolean startInclusive, boolean endInclusive)
      Returns the non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      non-business dates between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • nonBusinessDates

      public String[] nonBusinessDates(String start, String end, boolean startInclusive, boolean endInclusive)
      Returns the non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      non-business dates between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • nonBusinessDates

      public LocalDate[] nonBusinessDates(ZonedDateTime start, ZonedDateTime end, boolean startInclusive, boolean endInclusive)
      Returns the non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      non-business dates between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • nonBusinessDates

      public LocalDate[] nonBusinessDates(Instant start, Instant end, boolean startInclusive, boolean endInclusive)
      Returns the non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      startInclusive - true to include start in the result; false to exclude start
      endInclusive - true to include end in the result; false to exclude end
      Returns:
      non-business dates between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • nonBusinessDates

      public LocalDate[] nonBusinessDates(LocalDate start, LocalDate end)
      Returns the non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      non-business dates between start and end; including start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • nonBusinessDates

      public String[] nonBusinessDates(String start, String end)
      Returns the non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      non-business dates between start and end; including start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • nonBusinessDates

      public LocalDate[] nonBusinessDates(ZonedDateTime start, ZonedDateTime end)
      Returns the non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      non-business dates between start and end; including start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • nonBusinessDates

      public LocalDate[] nonBusinessDates(Instant start, Instant end)
      Returns the non-business dates in a given range.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      non-business dates between start and end; including start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffBusinessNanos

      public long diffBusinessNanos(Instant start, Instant end)
      Returns the amount of business time in nanoseconds between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of business time in nanoseconds between start and end. QueryConstants.NULL_LONG if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffBusinessNanos

      public long diffBusinessNanos(ZonedDateTime start, ZonedDateTime end)
      Returns the amount of business time in nanoseconds between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of business time in nanoseconds between start and end. QueryConstants.NULL_LONG if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffNonBusinessNanos

      public long diffNonBusinessNanos(Instant start, Instant end)
      Returns the amount of non-business time in nanoseconds between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of nonbusiness time in nanoseconds between start and end. QueryConstants.NULL_LONG if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffNonBusinessNanos

      public long diffNonBusinessNanos(ZonedDateTime start, ZonedDateTime end)
      Returns the amount of non-business time in nanoseconds between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of non-business time in nanoseconds between start and end. QueryConstants.NULL_LONG if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffBusinessDuration

      public Duration diffBusinessDuration(Instant start, Instant end)
      Returns the amount of business time between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of business time between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffBusinessDuration

      public Duration diffBusinessDuration(ZonedDateTime start, ZonedDateTime end)
      Returns the amount of business time between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of business time between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffNonBusinessDuration

      public Duration diffNonBusinessDuration(Instant start, Instant end)
      Returns the amount of non-business time between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of non-business time between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffNonBusinessDuration

      public Duration diffNonBusinessDuration(ZonedDateTime start, ZonedDateTime end)
      Returns the amount of non-business time between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of non-business time between start and end. null if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffBusinessDays

      public double diffBusinessDays(Instant start, Instant end)
      Returns the amount of business time in standard business days between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of business time in standard business days between start and end. QueryConstants.NULL_DOUBLE if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffBusinessDays

      public double diffBusinessDays(ZonedDateTime start, ZonedDateTime end)
      Returns the amount of business time in standard business days between two times.
      Parameters:
      start - start of a time range
      end - end of a time range
      Returns:
      the amount of business time in standard business days between start and end. QueryConstants.NULL_DOUBLE if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffBusinessYears

      public double diffBusinessYears(Instant start, Instant end)
      Returns the number of business years between start and end.
      Parameters:
      start - start; if null, return null
      end - end; if null, return null
      Returns:
      the amount of business time in business years between the start and end. QueryConstants.NULL_DOUBLE if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • diffBusinessYears

      public double diffBusinessYears(ZonedDateTime start, ZonedDateTime end)
      Returns the number of business years between start and end.
      Parameters:
      start - start; if null, return null
      end - end; if null, return null
      Returns:
      the amount of business time in business years between the start and end. QueryConstants.NULL_DOUBLE if any input is null.
      Throws:
      BusinessCalendar.InvalidDateException - if the dates are not in the valid range
    • plusBusinessDays

      public LocalDate plusBusinessDays(LocalDate date, int days)
      Adds a specified number of business days to an input date. Adding negative days is equivalent to subtracting days.
      Parameters:
      date - date
      days - number of days to add.
      Returns:
      days business days after date. null} if date is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • plusBusinessDays

      public String plusBusinessDays(String date, int days)
      Adds a specified number of business days to an input date. Adding negative days is equivalent to subtracting days.
      Parameters:
      date - date
      days - number of days to add.
      Returns:
      days business days after date. null if date is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • plusBusinessDays

      public Instant plusBusinessDays(Instant time, int days)
      Adds a specified number of business days to an input time. Adding negative days is equivalent to subtracting days. Day additions are not always 24 hours. The resultant time will have the same local time as the input time, as determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which is a 25-hour difference.
      Parameters:
      time - time
      days - number of days to add.
      Returns:
      days business days after time. null if time is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • plusBusinessDays

      public ZonedDateTime plusBusinessDays(ZonedDateTime time, int days)
      Adds a specified number of business days to an input time. Adding negative days is equivalent to subtracting days. Day additions are not always 24 hours. The resultant time will have the same local time as the input time, as determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which is a 25-hour difference. The resultant time will have the same time zone as the calendar. This could be different than the time zone of the input ZonedDateTime.
      Parameters:
      time - time
      days - number of days to add.
      Returns:
      days business days after time. null if time is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • minusBusinessDays

      public LocalDate minusBusinessDays(LocalDate date, int days)
      Subtracts a specified number of business days from an input date. Subtracting negative days is equivalent to adding days.
      Parameters:
      date - date
      days - number of days to add.
      Returns:
      days business days before date. null if date is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • minusBusinessDays

      public String minusBusinessDays(String date, int days)
      Subtracts a specified number of business days from an input date. Subtracting negative days is equivalent to adding days.
      Parameters:
      date - date
      days - number of days to add.
      Returns:
      days business days before date. null if date is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • minusBusinessDays

      public Instant minusBusinessDays(Instant time, int days)
      Subtracts a specified number of business days from an input time. Subtracting negative days is equivalent to adding days. Day subtractions are not always 24 hours. The resultant time will have the same local time as the input time, as determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which is a 25-hour difference.
      Parameters:
      time - time
      days - number of days to add.
      Returns:
      days business days before time. null if time is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • minusBusinessDays

      public ZonedDateTime minusBusinessDays(ZonedDateTime time, int days)
      Subtracts a specified number of business days from an input time. Subtracting negative days is equivalent to adding days. Day subtraction are not always 24 hours. The resultant time will have the same local time as the input time, as determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which is a 25-hour difference. The resultant time will have the same time zone as the calendar. This could be different than the time zone of the input ZonedDateTime.
      Parameters:
      time - time
      days - number of days to add.
      Returns:
      days business days before time. null if time is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • plusNonBusinessDays

      public LocalDate plusNonBusinessDays(LocalDate date, int days)
      Adds a specified number of non-business days to an input date. Adding negative days is equivalent to subtracting days.
      Parameters:
      date - date
      days - number of days to add.
      Returns:
      days non-business days after date. null if date is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • plusNonBusinessDays

      public String plusNonBusinessDays(String date, int days)
      Adds a specified number of non-business days to an input date. Adding negative days is equivalent to subtracting days.
      Parameters:
      date - date
      days - number of days to add.
      Returns:
      days non-business days after date. null if date is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • plusNonBusinessDays

      public Instant plusNonBusinessDays(Instant time, int days)
      Adds a specified number of non-business days to an input time. Adding negative days is equivalent to subtracting days. Day additions are not always 24 hours. The resultant time will have the same local time as the input time, as determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which is a 25-hour difference. The resultant time will have the same time zone as the calendar. This could be different than the time zone of the input ZonedDateTime.
      Parameters:
      time - time
      days - number of days to add.
      Returns:
      days non-business days after time. null if time is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • plusNonBusinessDays

      public ZonedDateTime plusNonBusinessDays(ZonedDateTime time, int days)
      Adds a specified number of non-business days to an input time. Adding negative days is equivalent to subtracting days. Day additions are not always 24 hours. The resultant time will have the same local time as the input time, as determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which is a 25-hour difference. The resultant time will have the same time zone as the calendar. This could be different than the time zone of the input ZonedDateTime.
      Parameters:
      time - time
      days - number of days to add.
      Returns:
      days non-business days after time. null if time is not a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • minusNonBusinessDays

      public LocalDate minusNonBusinessDays(LocalDate date, int days)
      Subtracts a specified number of non-business days to an input date. Subtracting negative days is equivalent to adding days.
      Parameters:
      date - date
      days - number of days to add.
      Returns:
      days non-business days before date. null if date is a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • minusNonBusinessDays

      public String minusNonBusinessDays(String date, int days)
      Subtracts a specified number of non-business days to an input date. Subtracting negative days is equivalent to adding days.
      Parameters:
      date - date
      days - number of days to add.
      Returns:
      days non-business days before date. null if date is a business day and days is zero.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
      DateTimeUtils.DateTimeParseException - if the string cannot be parsed
    • minusNonBusinessDays

      public Instant minusNonBusinessDays(Instant time, int days)
      Subtracts a specified number of non-business days to an input time. Subtracting negative days is equivalent to adding days. Day subtractions are not always 24 hours. The resultant time will have the same local time as the input time, as determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which is a 25-hour difference.
      Parameters:
      time - time
      days - number of days to add.
      Returns:
      days non-business days before time. null if time is a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • minusNonBusinessDays

      public ZonedDateTime minusNonBusinessDays(ZonedDateTime time, int days)
      Subtracts a specified number of non-business days to an input time. Subtracting negative days is equivalent to adding days. Day subtractions are not always 24 hours. The resultant time will have the same local time as the input time, as determined by the calendar's time zone. This accounts for Daylight Savings Time. For example, 2023-11-05 has a daylight savings time adjustment, so '2023-11-04T14:00 ET' plus 1 day will result in '2023-11-05T15:00 ET', which is a 25-hour difference. The resultant time will have the same time zone as the calendar. This could be different than the time zone of the input ZonedDateTime.
      Parameters:
      time - time
      days - number of days to add.
      Returns:
      days non-business days before time. null if time is a business day and days is zero. null if inputs are null or QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • futureBusinessDate

      public LocalDate futureBusinessDate(int days)
      Adds a specified number of business days to the current date. Adding negative days is equivalent to subtracting days.
      Parameters:
      days - number of days to add.
      Returns:
      days business days after the current date. null if the current date is not a business day and days is zero. null if input is QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • pastBusinessDate

      public LocalDate pastBusinessDate(int days)
      Subtracts a specified number of business days from the current date. Subtracting negative days is equivalent to adding days.
      Parameters:
      days - number of days to subtract.
      Returns:
      days business days before the current date. null if the current date is not a business day and days is zero. null if input is QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • futureNonBusinessDate

      public LocalDate futureNonBusinessDate(int days)
      Adds a specified number of non-business days to the current date. Adding negative days is equivalent to subtracting days.
      Parameters:
      days - number of days to add.
      Returns:
      days non-business days after the current date. null if the current date is a business day and days is zero. null if input is QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range
    • pastNonBusinessDate

      public LocalDate pastNonBusinessDate(int days)
      Subtracts a specified number of non-business days to the current date. Subtracting negative days is equivalent to adding days.
      Parameters:
      days - number of days to subtract.
      Returns:
      days non-business days before the current date. null if the current date is a business day and days is zero. null if input is QueryConstants.NULL_INT.
      Throws:
      BusinessCalendar.InvalidDateException - if the date is not in the valid range