Class DateTimeUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classException type thrown when operations on date time values would exceed the range available by max or min long nanoseconds.static classException type thrown when date time string representations can not be parsed. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longOne day in nanoseconds.static final doubleNumber of days per nanosecond.static final longOne hour in nanoseconds.static final doubleNumber of hours per nanosecond.static final longOne microsecond in nanoseconds.static final longOne millisecond in nanoseconds.static final longOne minute in nanoseconds.static final doubleNumber of minutes per nanosecond.static final longOne second in nanoseconds.static final doubleNumber of seconds per nanosecond.static final longOne week in nanoseconds.static final longOne 365 day year in nanoseconds.static final longOne average year in nanoseconds.static final doubleNumber of 365 day years per nanosecond.static final doubleNumber of average (365.2425 day) years per nanosecond.static final Instant[]A zero length array ofinstants. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable InstantatMidnight(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns anInstantfor the prior midnight in the specified time zone.static @Nullable ZonedDateTimeatMidnight(@Nullable LocalDate date, @Nullable ZoneId timeZone) Returns anZonedDateTimefor the prior midnight in the specified time zone.static @Nullable ZonedDateTimeatMidnight(@Nullable ZonedDateTime dateTime) Returns aZonedDateTimefor the prior midnight in the specified time zone.static @NotNull io.deephaven.base.clock.ClockReturns the clock used to compute the current time.static intdayOfMonth(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns a 1-based int value of the day of the month for anInstantand specified time zone.static intdayOfMonth(@Nullable LocalDate date) Returns a 1-based int value of the day of the month for aZonedDateTimeand specified time zone.static intdayOfMonth(@Nullable ZonedDateTime dateTime) Returns a 1-based int value of the day of the month for aZonedDateTimeand specified time zone.static DayOfWeekReturns the day of the week for anInstantin the specified time zone.static DayOfWeekReturns athe day of the week for aZonedDateTimein the specified time zone.static DayOfWeekdayOfWeek(@Nullable ZonedDateTime dateTime) Returns the day of the week for aZonedDateTimein the specified time zone.static intdayOfWeekValue(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns a 1-based int value of the day of the week for anInstantin the specified time zone, with 1 being Monday and 7 being Sunday.static intdayOfWeekValue(@Nullable LocalDate date) Returns a 1-based int value of the day of the week for aZonedDateTimein the specified time zone, with 1 being Monday and 7 being Sunday.static intdayOfWeekValue(@Nullable ZonedDateTime dateTime) Returns a 1-based int value of the day of the week for aZonedDateTimein the specified time zone, with 1 being Monday and 7 being Sunday.static intReturns a 1-based int value of the day of the year (Julian date) for anInstantin the specified time zone.static intReturns a 1-based int value of the day of the year (Julian date) for aZonedDateTimein the specified time zone.static intdayOfYear(@Nullable ZonedDateTime dateTime) Returns a 1-based int value of the day of the year (Julian date) for aZonedDateTimein the specified time zone.static doubleReturns the difference in days between two instant values.static doublediffDays(@Nullable ZonedDateTime start, @Nullable ZonedDateTime end) Returns the difference in days between two zoned date time values.static longdiffMicros(@Nullable Instant start, @Nullable Instant end) Returns the difference in microseconds between two instant values.static longdiffMicros(@Nullable ZonedDateTime start, @Nullable ZonedDateTime end) Returns the difference in microseconds between two zoned date time values.static longdiffMillis(@Nullable Instant start, @Nullable Instant end) Returns the difference in milliseconds between two instant values.static longdiffMillis(@Nullable ZonedDateTime start, @Nullable ZonedDateTime end) Returns the difference in milliseconds between two zoned date time values.static doublediffMinutes(@Nullable Instant start, @Nullable Instant end) Returns the difference in minutes between two instant values.static doublediffMinutes(@Nullable ZonedDateTime start, @Nullable ZonedDateTime end) Returns the difference in minutes between two zoned date time values.static longReturns the difference in nanoseconds between two instant values.static longdiffNanos(@Nullable ZonedDateTime start, @Nullable ZonedDateTime end) Returns the difference in nanoseconds between two zoned date time values.static doublediffSeconds(@Nullable Instant start, @Nullable Instant end) Returns the difference in seconds between two instant values.static doublediffSeconds(@Nullable ZonedDateTime start, @Nullable ZonedDateTime end) Returns the difference in seconds between two zoned date time values.static doublediffYears365(@Nullable Instant start, @Nullable Instant end) Returns the difference in years between two instant values.static doublediffYears365(@Nullable ZonedDateTime start, @Nullable ZonedDateTime end) Returns the difference in years between two zoned date time values.static doublediffYearsAvg(@Nullable Instant start, @Nullable Instant end) Returns the difference in years between two instant values.static doublediffYearsAvg(@Nullable ZonedDateTime start, @Nullable ZonedDateTime end) Returns the difference in years between two zoned date time values.static longepochAutoToEpochNanos(long epochOffset) Converts an offset from the Epoch to a nanoseconds from the Epoch.static @Nullable InstantepochAutoToInstant(long epochOffset) Converts an offset from the Epoch to anInstant.static @Nullable ZonedDateTimeepochAutoToZonedDateTime(long epochOffset, @Nullable ZoneId timeZone) Converts an offset from the Epoch to aZonedDateTime.static longReturns number of days from the Epoch for aLocalDatevalue.static intepochDaysAsInt(@Nullable LocalDate date) Returns number of days (as anint) from the Epoch for aLocalDatevalue.static @Nullable LocalDateepochDaysAsIntToLocalDate(int days) Converts days from the Epoch (stored asint) to aLocalDate.static @Nullable LocalDateepochDaysToLocalDate(long days) Converts days from the Epoch to aLocalDate.static longepochMicros(@Nullable Instant instant) Returns microseconds from the Epoch for anInstantvalue.static longepochMicros(@Nullable ZonedDateTime dateTime) Returns microseconds from the Epoch for aZonedDateTimevalue.static @Nullable InstantepochMicrosToInstant(long micros) Converts microseconds from the Epoch to anInstant.static @Nullable ZonedDateTimeepochMicrosToZonedDateTime(long micros, @Nullable ZoneId timeZone) Converts microseconds from the Epoch to aZonedDateTime.static longepochMillis(@Nullable Instant instant) Returns milliseconds from the Epoch for anInstantvalue.static longepochMillis(@Nullable ZonedDateTime dateTime) Returns milliseconds from the Epoch for aZonedDateTimevalue.static @Nullable InstantepochMillisToInstant(long millis) Converts milliseconds from the Epoch to anInstant.static @Nullable ZonedDateTimeepochMillisToZonedDateTime(long millis, @Nullable ZoneId timeZone) Converts milliseconds from the Epoch to aZonedDateTime.static longepochNanos(@Nullable Instant instant) Returns nanoseconds from the Epoch for anInstantvalue.static longepochNanos(@Nullable ZonedDateTime dateTime) Returns nanoseconds from the Epoch for aZonedDateTimevalue.static @Nullable InstantepochNanosToInstant(long nanos) Converts nanoseconds from the Epoch to anInstant.static @Nullable ZonedDateTimeepochNanosToZonedDateTime(long nanos, ZoneId timeZone) Converts nanoseconds from the Epoch to aZonedDateTime.static longepochSeconds(@Nullable Instant instant) Returns seconds since from the Epoch for anInstantvalue.static longepochSeconds(@Nullable ZonedDateTime dateTime) Returns seconds since from the Epoch for aZonedDateTimevalue.static @Nullable InstantepochSecondsToInstant(long seconds) Converts seconds from the Epoch to anInstant.static @Nullable ZonedDateTimeepochSecondsToZonedDateTime(long seconds, @Nullable ZoneId timeZone) Converts seconds from the Epoch to aZonedDateTime.static @Nullable InstantexcelToInstant(double excel, @Nullable ZoneId timeZone) Converts an Excel time represented as a double to anInstant.static @Nullable ZonedDateTimeexcelToZonedDateTime(double excel, @Nullable ZoneId timeZone) Converts an Excel time represented as a double to aZonedDateTime.static @Nullable StringformatDate(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns anInstantformatted as a "yyyy-MM-dd" string.static @Nullable StringformatDate(@Nullable LocalDate date) Returns aLocalDateformatted as a "yyyy-MM-dd" string.static @Nullable StringformatDate(@Nullable ZonedDateTime dateTime) Returns aZonedDateTimeformatted as a "yyyy-MM-dd" string.static @Nullable StringformatDateTime(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns anInstantformatted as a "yyyy-MM-ddThh:mm:ss.SSSSSSSSS TZ" string.static @Nullable StringformatDateTime(@Nullable ZonedDateTime dateTime) Returns aZonedDateTimeformatted as a "yyyy-MM-ddThh:mm:ss.SSSSSSSSS TZ" string.static @Nullable StringformatDurationNanos(long nanos) Returns a nanosecond duration formatted as a "[-]PThhh:mm:ss.nnnnnnnnn" string.static intDeprecated.static intReturns the number of hours that have elapsed since the start of the day.static intReturns the number of hours that have elapsed since the start of the day.static inthourOfDay(@Nullable ZonedDateTime dateTime) Deprecated.UsehourOfDay(ZonedDateTime, boolean)instead.static inthourOfDay(@Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of hours that have elapsed since the start of the day.static booleanEvaluates whether one instant value is after a second instant value.static booleanisAfter(@Nullable ZonedDateTime dateTime1, @Nullable ZonedDateTime dateTime2) Evaluates whether one zoned date time value is after a second zoned date time value.static booleanisAfterOrEqual(@Nullable Instant instant1, @Nullable Instant instant2) Evaluates whether one instant value is after or equal to a second instant value.static booleanisAfterOrEqual(@Nullable ZonedDateTime dateTime1, @Nullable ZonedDateTime dateTime2) Evaluates whether one zoned date time value is after or equal to a second zoned date time value.static booleanEvaluates whether one instant value is before a second instant value.static booleanisBefore(@Nullable ZonedDateTime dateTime1, @Nullable ZonedDateTime dateTime2) Evaluates whether one zoned date time value is before a second zoned date time value.static booleanisBeforeOrEqual(@Nullable Instant instant1, @Nullable Instant instant2) Evaluates whether one instant value is before or equal to a second instant value.static booleanisBeforeOrEqual(@Nullable ZonedDateTime dateTime1, @Nullable ZonedDateTime dateTime2) Evaluates whether one zoned date time value is before or equal to a second zoned date time value.static @Nullable InstantReturns anInstantvalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds.static @Nullable InstantReturns anInstantvalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds.static @Nullable InstantReturns anInstantvalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds.static @Nullable InstantReturns anInstantvalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds.static @Nullable ZonedDateTimelowerBin(@Nullable ZonedDateTime dateTime, long intervalNanos) Returns aZonedDateTimevalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds.static @Nullable ZonedDateTimelowerBin(@Nullable ZonedDateTime dateTime, long intervalNanos, long offset) Returns aZonedDateTimevalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds.static @Nullable ZonedDateTimelowerBin(@Nullable ZonedDateTime dateTime, Duration interval) Returns aZonedDateTimevalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds.static @Nullable ZonedDateTimelowerBin(@Nullable ZonedDateTime dateTime, Duration interval, Duration offset) Returns aZonedDateTimevalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds.static @Nullable LocalTimemicrosOfDayToLocalTime(long micros) Converts the number of microseconds from midnight to aLocalTimestatic intmicrosOfMilli(@Nullable Instant instant) Returns the number of microseconds that have elapsed since the top of the millisecond.static intmicrosOfMilli(@Nullable ZonedDateTime dateTime) Returns the number of microseconds that have elapsed since the top of the millisecond.static longmicrosOfSecond(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns the number of microseconds that have elapsed since the top of the second.static longmicrosOfSecond(@Nullable ZonedDateTime dateTime) Returns the number of microseconds that have elapsed since the top of the second.static longmicrosToMillis(long micros) Converts microseconds to milliseconds.static longmicrosToNanos(long micros) Converts microseconds to nanoseconds.static longmicrosToSeconds(long micros) Converts microseconds to seconds.static intmillisOfDay(@Nullable Instant instant, @Nullable ZoneId timeZone) Deprecated.UsemillisOfDay(Instant, ZoneId, boolean)instead.static intmillisOfDay(@Nullable Instant instant, @Nullable ZoneId timeZone, boolean localTime) Returns the number of milliseconds that have elapsed since the start of the day.static intmillisOfDay(@Nullable LocalTime localTime) Returns the number of milliseconds that have elapsed since the start of the day.static intmillisOfDay(@Nullable ZonedDateTime dateTime) Deprecated.UsemillisOfDay(ZonedDateTime, boolean)instead.static intmillisOfDay(@Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of milliseconds that have elapsed since the start of the day.static @Nullable LocalTimemillisOfDayToLocalTime(int millis) Converts the number of milliseconds from midnight to aLocalTimestatic intmillisOfSecond(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns the number of milliseconds that have elapsed since the top of the second.static intmillisOfSecond(@Nullable ZonedDateTime dateTime) Returns the number of milliseconds that have elapsed since the top of the second.static longmillisToMicros(long millis) Converts milliseconds to microseconds.static longmillisToNanos(long millis) Converts milliseconds to nanoseconds.static longmillisToSeconds(long millis) Converts milliseconds to seconds.static @Nullable InstantSubtracts nanoseconds from anInstant.static @Nullable InstantSubtracts a time period to anInstant.static longSubtract one instant from another and return the difference in nanoseconds.static @Nullable InstantSubtracts a time period to anInstant.static @Nullable LocalDateSubtracts a time period from aLocalDate.static @Nullable ZonedDateTimeminus(@Nullable ZonedDateTime dateTime, long nanos) Subtracts nanoseconds from aZonedDateTime.static @Nullable ZonedDateTimeminus(@Nullable ZonedDateTime dateTime, @Nullable Duration duration) Subtracts a time period to aZonedDateTime.static @Nullable ZonedDateTimeminus(@Nullable ZonedDateTime dateTime, @Nullable Period period) Subtracts a time period to aZonedDateTime.static longminus(@Nullable ZonedDateTime dateTime1, @Nullable ZonedDateTime dateTime2) Subtract one zoned date time from another and return the difference in nanoseconds.static @Nullable LocalDateSubtracts days from aLocalDate.static intminuteOfDay(@Nullable Instant instant, @Nullable ZoneId timeZone) Deprecated.UseminuteOfDay(Instant, ZoneId, boolean)instead.static intminuteOfDay(@Nullable Instant instant, @Nullable ZoneId timeZone, boolean localTime) Returns the number of minutes that have elapsed since the start of the day.static intminuteOfDay(@Nullable LocalTime localTime) Returns the number of minutes that have elapsed since the start of the day.static intminuteOfDay(@Nullable ZonedDateTime dateTime) Deprecated.UseminuteOfDay(ZonedDateTime, boolean)instead.static intminuteOfDay(@Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of minutes that have elapsed since the start of the day.static intminuteOfHour(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns the number of minutes that have elapsed since the top of the hour.static intminuteOfHour(@Nullable ZonedDateTime dateTime) Returns the number of minutes that have elapsed since the top of the hour.static intmonthOfYear(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns a 1-based int value of the month of the year (Julian date) for anInstantin the specified time zone.static intmonthOfYear(@Nullable LocalDate date) Returns a 1-based int value of the month of the year (Julian date) for aLocalDate.static intmonthOfYear(@Nullable ZonedDateTime dateTime) Returns a 1-based int value of the month of the year (Julian date) for aZonedDateTimein the specified time zone.static longnanosOfDay(@Nullable Instant instant, @Nullable ZoneId timeZone) Deprecated.UsenanosOfDay(Instant, ZoneId, boolean)instead.static longnanosOfDay(@Nullable Instant instant, @Nullable ZoneId timeZone, boolean localTime) Returns the number of nanoseconds that have elapsed since the start of the day.static longnanosOfDay(@Nullable LocalTime localTime) Returns the number of nanoseconds that have elapsed since the start of the day.static longnanosOfDay(@Nullable ZonedDateTime dateTime) Deprecated.UsenanosOfDay(ZonedDateTime, boolean)instead.static longnanosOfDay(@Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of nanoseconds that have elapsed since the start of the day.static @Nullable LocalTimenanosOfDayToLocalTime(long nanos) Converts the number of nanoseconds from midnight to aLocalTimestatic intnanosOfMilli(@Nullable Instant instant) Returns the number of nanoseconds that have elapsed since the top of the millisecond.static intnanosOfMilli(@Nullable ZonedDateTime dateTime) Returns the number of nanoseconds that have elapsed since the top of the millisecond.static longnanosOfSecond(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns the number of nanoseconds that have elapsed since the top of the second.static longnanosOfSecond(@Nullable ZonedDateTime dateTime) Returns the number of nanoseconds that have elapsed since the top of the second.static longnanosToMicros(long nanos) Converts nanoseconds to microseconds.static longnanosToMillis(long nanos) Converts nanoseconds to milliseconds.static longnanosToSeconds(long nanos) Converts nanoseconds to seconds.static @NotNull Instantnow()Provides the currentinstantwith nanosecond resolution according to thecurrent clock.static @NotNull InstantProvides the currentinstantwith millisecond resolution according to thecurrent clock.static @NotNull InstantProvides the currentinstantwith nanosecond resolution according to thesystem clock.static @NotNull InstantProvides the currentinstantwith millisecond resolution according to thesystem clock.static @NotNull DurationparseDuration(@NotNull String s) Parses the string argument as a duration, which is a unit of time in terms of clock time (24-hour days, hours, minutes, seconds, and nanoseconds).static longparseDurationNanos(@NotNull String s) Parses the string argument as a time duration in nanoseconds.static longparseDurationNanosQuiet(@Nullable String s) Parses the string argument as a time duration in nanoseconds.static @Nullable DurationparseDurationQuiet(@Nullable String s) Parses the string argument as a duration, which is a unit of time in terms of clock time (24-hour days, hours, minutes, seconds, and nanoseconds).static longparseEpochNanos(@NotNull String s) Parses the string argument as nanoseconds since the Epoch.static longparseEpochNanosQuiet(@Nullable String s) Parses the string argument as a nanoseconds since the Epoch.static @NotNull InstantparseInstant(@NotNull String s) Parses the string argument as anInstant.static @Nullable InstantparseInstantQuiet(@Nullable String s) Parses the string argument as anInstant.static @NotNull LocalDateparseLocalDate(@NotNull String s) Parses the string argument as a local date, which is a date without a time or time zone.static @Nullable LocalDateparseLocalDateQuiet(@Nullable String s) Parses the string argument as a local date, which is a date without a time or time zone.static @NotNull LocalTimeparseLocalTime(@NotNull String s) Parses the string argument as a local time, which is the time that would be read from a clock and does not have a date or timezone.static @Nullable LocalTimeparseLocalTimeQuiet(@Nullable String s) Parses the string argument as a local time, which is the time that would be read from a clock and does not have a date or timezone.static @NotNull PeriodparsePeriod(@NotNull String s) Parses the string argument as a period, which is a unit of time in terms of calendar time (days, weeks, months, years, etc.).static @Nullable PeriodparsePeriodQuiet(@Nullable String s) Parses the string argument as a period, which is a unit of time in terms of calendar time (days, weeks, months, years, etc.).static @NotNull ChronoFieldparseTimePrecision(@NotNull String s) Returns aChronoFieldindicating the level of precision in a time, datetime, or period nanos string.static @Nullable ChronoFieldparseTimePrecisionQuiet(@Nullable String s) Returns aChronoFieldindicating the level of precision in a time or datetime string.static @NotNull ZoneIdparseTimeZone(@NotNull String s) Parses the string argument as a time zone.static @Nullable ZoneIdparseTimeZoneQuiet(@Nullable String s) Parses the string argument as a time zone.static @NotNull ZonedDateTimeparseZonedDateTime(@NotNull String s) Parses the string argument as aZonedDateTime.static @Nullable ZonedDateTimeparseZonedDateTimeQuiet(@Nullable String s) Parses the string argument as aZonedDateTime.static @Nullable InstantAdds nanoseconds to anInstant.static @Nullable InstantAdds a time period to anInstant.static @Nullable InstantAdds a time period to anInstant.static @Nullable LocalDateAdds a time period to aLocalDate.static @Nullable ZonedDateTimeplus(@Nullable ZonedDateTime dateTime, long nanos) Adds nanoseconds to aZonedDateTime.static @Nullable ZonedDateTimeplus(@Nullable ZonedDateTime dateTime, @Nullable Duration duration) Adds a time period to aZonedDateTime.static @Nullable ZonedDateTimeplus(@Nullable ZonedDateTime dateTime, @Nullable Period period) Adds a time period to aZonedDateTime.static @Nullable LocalDateAdds days to aLocalDate.static intsecondOfDay(@Nullable Instant instant, @Nullable ZoneId timeZone) Deprecated.UsesecondOfDay(Instant, ZoneId, boolean)instead.static intsecondOfDay(@Nullable Instant instant, @Nullable ZoneId timeZone, boolean localTime) Returns the number of seconds that have elapsed since the start of the day.static intsecondOfDay(@Nullable LocalTime localTime) Returns the number of seconds that have elapsed since the start of the day.static intsecondOfDay(@Nullable ZonedDateTime dateTime) Deprecated.UsesecondOfDay(ZonedDateTime, boolean)instead.static intsecondOfDay(@Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of seconds that have elapsed since the start of the day.static intsecondOfMinute(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns the number of seconds that have elapsed since the top of the minute.static intsecondOfMinute(@Nullable ZonedDateTime dateTime) Returns the number of seconds that have elapsed since the top of the minute.static longsecondsToMicros(long seconds) Converts seconds to microseconds.static longsecondsToMillis(long seconds) Converts seconds to milliseconds.static longsecondsToNanos(long seconds) Converts seconds to nanoseconds.static voidsetClock(@Nullable io.deephaven.base.clock.Clock clock) Set the clock used to compute the current time.static ZoneIdtimeZone()Gets thesystem default time zone.static @Nullable ZoneIdGets the time zone for a time zone name.static voidtimeZoneAliasAdd(@NotNull String alias, @NotNull String timeZone) Adds a new time zone alias.static booleantimeZoneAliasRm(@NotNull String alias) Removes a time zone alias.static @Nullable DateDeprecated.static @Nullable DatetoDate(@Nullable ZonedDateTime dateTime) Deprecated.static @NotNull Stringtoday()Provides the current date string according to thecurrent clockand thedefault time zone.static @Nullable StringProvides the current date string according to thecurrent clock.static @NotNull LocalDateProvides the current date according to thecurrent clockand thedefault time zone.static @Nullable LocalDatetodayLocalDate(@Nullable ZoneId timeZone) Provides the current date according to thecurrent clock.static doubletoExcelTime(@Nullable Instant instant, @Nullable ZoneId timeZone) Converts anInstantto an Excel time represented as a double.static doubletoExcelTime(@Nullable ZonedDateTime dateTime) Converts aZonedDateTimeto an Excel time represented as a double.static @Nullable Instantstatic @Nullable InstanttoInstant(@Nullable ZonedDateTime dateTime) Converts aZonedDateTimeto anInstant.static @Nullable InstantDeprecated.static @Nullable LocalDatetoLocalDate(@Nullable Instant instant, @Nullable ZoneId timeZone) static @Nullable LocalDatetoLocalDate(@Nullable ZonedDateTime dateTime) Get theLocalDateportion of aZonedDateTime.static @Nullable LocalTimetoLocalTime(@Nullable Instant instant, @Nullable ZoneId timeZone) static @Nullable LocalTimetoLocalTime(@Nullable ZonedDateTime dateTime) Get theLocalTimeportion of aZonedDateTime.static @Nullable ZonedDateTimetoZonedDateTime(@Nullable Instant instant, @Nullable ZoneId timeZone) Converts anInstantto aZonedDateTime.static @Nullable ZonedDateTimetoZonedDateTime(@Nullable LocalDate date, @Nullable LocalTime time, @Nullable ZoneId timeZone) static @Nullable InstantReturns anInstantvalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds.static @Nullable InstantReturns anInstantvalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds.static @Nullable InstantReturns anInstantvalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds.static @Nullable InstantReturns anInstantvalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds.static @Nullable ZonedDateTimeupperBin(@Nullable ZonedDateTime dateTime, long intervalNanos) Returns aZonedDateTimevalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds.static @Nullable ZonedDateTimeupperBin(@Nullable ZonedDateTime dateTime, long intervalNanos, long offset) Returns aZonedDateTimevalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds.static @Nullable ZonedDateTimeupperBin(@Nullable ZonedDateTime dateTime, Duration interval) Returns aZonedDateTimevalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds.static @Nullable ZonedDateTimeupperBin(@Nullable ZonedDateTime dateTime, Duration interval, Duration offset) Returns aZonedDateTimevalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds.static intReturns the year for anInstantin the specified time zone.static intReturns the year for aLocalDate.static intyear(@Nullable ZonedDateTime dateTime) Returns the year for aZonedDateTimein the specified time zone.static intyearOfCentury(@Nullable Instant instant, @Nullable ZoneId timeZone) Returns the year of the century (two-digit year) for anInstantin the specified time zone.static intyearOfCentury(@Nullable LocalDate date) Returns the year of the century (two-digit year) for aLocalDatein the specified time zone.static intyearOfCentury(@Nullable ZonedDateTime dateTime) Returns the year of the century (two-digit year) for aZonedDateTimein the specified time zone.
-
Field Details
-
ZERO_LENGTH_INSTANT_ARRAY
A zero length array ofinstants. -
MICRO
public static final long MICROOne microsecond in nanoseconds.- See Also:
-
MILLI
public static final long MILLIOne millisecond in nanoseconds.- See Also:
-
SECOND
public static final long SECONDOne second in nanoseconds.- See Also:
-
MINUTE
public static final long MINUTEOne minute in nanoseconds.- See Also:
-
HOUR
public static final long HOUROne hour in nanoseconds.- See Also:
-
DAY
public static final long DAYOne day in nanoseconds. This is one hour of wall time and does not take into account calendar adjustments.- See Also:
-
WEEK
public static final long WEEKOne week in nanoseconds. This is 7 days of wall time and does not take into account calendar adjustments.- See Also:
-
YEAR_365
public static final long YEAR_365One 365 day year in nanoseconds. This is 365 days of wall time and does not take into account calendar adjustments.- See Also:
-
YEAR_AVG
public static final long YEAR_AVGOne average year in nanoseconds. This is 365.2425 days of wall time and does not take into account calendar adjustments.- See Also:
-
SECONDS_PER_NANO
public static final double SECONDS_PER_NANONumber of seconds per nanosecond.- See Also:
-
MINUTES_PER_NANO
public static final double MINUTES_PER_NANONumber of minutes per nanosecond.- See Also:
-
HOURS_PER_NANO
public static final double HOURS_PER_NANONumber of hours per nanosecond.- See Also:
-
DAYS_PER_NANO
public static final double DAYS_PER_NANONumber of days per nanosecond.- See Also:
-
YEARS_PER_NANO_365
public static final double YEARS_PER_NANO_365Number of 365 day years per nanosecond.- See Also:
-
YEARS_PER_NANO_AVG
public static final double YEARS_PER_NANO_AVGNumber of average (365.2425 day) years per nanosecond.- See Also:
-
-
Constructor Details
-
DateTimeUtils
public DateTimeUtils()
-
-
Method Details
-
setClock
@ScriptApi public static void setClock(@Nullable @Nullable io.deephaven.base.clock.Clock clock) Set the clock used to compute the current time. This allows a custom clock to be used instead of the current system clock. This is mainly used for replay simulations.- Parameters:
clock- the clock used to compute the current time; ifnull, use the system clock
-
currentClock
@NotNull @ScriptApi public static @NotNull io.deephaven.base.clock.Clock currentClock()Returns the clock used to compute the current time. This may be the current system clock, or it may be an alternative clock used for replay simulations.- Returns:
- the current clock
- See Also:
-
now
Provides the currentinstantwith nanosecond resolution according to thecurrent clock. Under most circumstances, this method will return the current system time, but during replay simulations, this method can return the replay time.- Returns:
- the current instant with nanosecond resolution according to the current clock
- See Also:
-
nowMillisResolution
Provides the currentinstantwith millisecond resolution according to thecurrent clock. Under most circumstances, this method will return the current system time, but during replay simulations, this method can return the replay time.- Returns:
- the current instant with millisecond resolution according to the current clock
- See Also:
-
nowSystem
Provides the currentinstantwith nanosecond resolution according to thesystem clock. Note that the system time may not be desirable during replay simulations.- Returns:
- the current instant with nanosecond resolution according to the system clock
- See Also:
-
nowSystemMillisResolution
Provides the currentinstantwith millisecond resolution according to thesystem clock. Note that the system time may not be desirable during replay simulations.- Returns:
- the current instant with millisecond resolution according to the system clock
- See Also:
-
today
Provides the current date string according to thecurrent clock. Under most circumstances, this method will return the date according to current system time, but during replay simulations, this method can return the date according to replay time.- Parameters:
timeZone- the time zone- Returns:
- the current date according to the current clock and time zone formatted as "yyyy-MM-dd".
nullif the input isnull. - See Also:
-
today
Provides the current date string according to thecurrent clockand thedefault time zone. Under most circumstances, this method will return the date according to current system time, but during replay simulations, this method can return the date according to replay time.- Returns:
- the current date according to the current clock and default time zone formatted as "yyyy-MM-dd"
- See Also:
-
todayLocalDate
@ScriptApi @Nullable public static @Nullable LocalDate todayLocalDate(@Nullable @Nullable ZoneId timeZone) Provides the current date according to thecurrent clock. Under most circumstances, this method will return the date according to current system time, but during replay simulations, this method can return the date according to replay time.- Parameters:
timeZone- the time zone- Returns:
- the current date according to the current clock and time zone formatted as "yyyy-MM-dd".
nullif the input isnull. - See Also:
-
todayLocalDate
Provides the current date according to thecurrent clockand thedefault time zone. Under most circumstances, this method will return the date according to current system time, but during replay simulations, this method can return the date according to replay time.- Returns:
- the current date according to the current clock and default time zone formatted as "yyyy-MM-dd"
- See Also:
-
timeZone
Gets the time zone for a time zone name.- Parameters:
timeZone- the time zone name- Returns:
- the corresponding time zone.
nullif the input isnull. - Throws:
DateTimeException- iftimeZonehas an invalid formatZoneRulesException- iftimeZonecannot be found
-
timeZone
Gets thesystem default time zone.- Returns:
- the system default time zone
- See Also:
-
timeZoneAliasAdd
public static void timeZoneAliasAdd(@NotNull @NotNull String alias, @NotNull @NotNull String timeZone) Adds a new time zone alias.- Parameters:
alias- the alias nametimeZone- the time zone id name- Throws:
IllegalArgumentException- if the alias already exists or the time zone is invalid
-
timeZoneAliasRm
Removes a time zone alias.- Parameters:
alias- the alias name- Returns:
- whether
aliaswas present
-
microsToNanos
@ScriptApi public static long microsToNanos(long micros) Converts microseconds to nanoseconds.- Parameters:
micros- the microseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input microseconds converted to nanoseconds
-
millisToNanos
@ScriptApi public static long millisToNanos(long millis) Converts milliseconds to nanoseconds.- Parameters:
millis- the milliseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input milliseconds converted to nanoseconds
-
secondsToNanos
@ScriptApi public static long secondsToNanos(long seconds) Converts seconds to nanoseconds.- Parameters:
seconds- the seconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input seconds converted to nanoseconds
-
nanosToMicros
@ScriptApi public static long nanosToMicros(long nanos) Converts nanoseconds to microseconds.- Parameters:
nanos- the nanoseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input nanoseconds converted to microseconds, rounded down
-
millisToMicros
@ScriptApi public static long millisToMicros(long millis) Converts milliseconds to microseconds.- Parameters:
millis- the milliseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input milliseconds converted to microseconds, rounded down
-
secondsToMicros
@ScriptApi public static long secondsToMicros(long seconds) Converts seconds to microseconds.- Parameters:
seconds- the seconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input seconds converted to microseconds, rounded down
-
nanosToMillis
@ScriptApi public static long nanosToMillis(long nanos) Converts nanoseconds to milliseconds.- Parameters:
nanos- the nanoseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input nanoseconds converted to milliseconds, rounded down
-
microsToMillis
@ScriptApi public static long microsToMillis(long micros) Converts microseconds to milliseconds.- Parameters:
micros- the microseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input microseconds converted to milliseconds, rounded down
-
secondsToMillis
@ScriptApi public static long secondsToMillis(long seconds) Converts seconds to milliseconds.- Parameters:
seconds- the nanoseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input seconds converted to milliseconds, rounded down
-
nanosToSeconds
@ScriptApi public static long nanosToSeconds(long nanos) Converts nanoseconds to seconds.- Parameters:
nanos- the nanoseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input nanoseconds converted to seconds, rounded down
-
microsToSeconds
@ScriptApi public static long microsToSeconds(long micros) Converts microseconds to seconds.- Parameters:
micros- the microseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input microseconds converted to seconds, rounded down
-
millisToSeconds
@ScriptApi public static long millisToSeconds(long millis) Converts milliseconds to seconds.- Parameters:
millis- the milliseconds to convert- Returns:
QueryConstants.NULL_LONGif the input isQueryConstants.NULL_LONG; otherwise the input milliseconds converted to seconds, rounded down
-
toInstant
@ScriptApi @Nullable public static @Nullable Instant toInstant(@Nullable @Nullable ZonedDateTime dateTime) Converts aZonedDateTimeto anInstant.- Parameters:
dateTime- the zoned date time to convert- Returns:
- the
Instant, ornullifdateTimeisnull
-
toInstant
@ScriptApi @Nullable public static @Nullable Instant toInstant(@Nullable @Nullable LocalDate date, @Nullable @Nullable LocalTime time, @Nullable @Nullable ZoneId timeZone) - Parameters:
date- the local datetime- the local timetimeZone- the time zone- Returns:
- the
Instant, ornullif any input isnull
-
toInstant
@ScriptApi @Nullable @Deprecated public static @Nullable Instant toInstant(@Nullable @Nullable Date date) Deprecated.- Parameters:
date- the date to convert- Returns:
- the
Instant, ornullifdateisnull
-
toZonedDateTime
@ScriptApi @Nullable public static @Nullable ZonedDateTime toZonedDateTime(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Converts anInstantto aZonedDateTime.- Parameters:
instant- the instant to converttimeZone- the time zone to use- Returns:
- the
ZonedDateTime, ornullif any input isnull
-
toZonedDateTime
@ScriptApi @Nullable public static @Nullable ZonedDateTime toZonedDateTime(@Nullable @Nullable LocalDate date, @Nullable @Nullable LocalTime time, @Nullable @Nullable ZoneId timeZone) - Parameters:
date- the local datetime- the local timetimeZone- the time zone to use- Returns:
- the
ZonedDateTime, ornullif any input isnull
-
toLocalDate
@Nullable public static @Nullable LocalDate toLocalDate(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) - Parameters:
instant- the instant to converttimeZone- the time zone- Returns:
- the
LocalDate, ornullif any input isnull
-
toLocalDate
Get theLocalDateportion of aZonedDateTime.- Parameters:
dateTime- the zoned date time to convert- Returns:
- the
LocalDate, ornullifdateTimeisnull
-
toLocalTime
@Nullable public static @Nullable LocalTime toLocalTime(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) - Parameters:
instant- the instant to converttimeZone- the time zone- Returns:
- the
LocalTime, ornullif any input isnull
-
toLocalTime
Get theLocalTimeportion of aZonedDateTime.- Parameters:
dateTime- the zoned date time to convert- Returns:
- the
LocalTime, ornullifdateTimeisnull
-
millisOfDayToLocalTime
Converts the number of milliseconds from midnight to aLocalTime- Parameters:
millis- milliseconds from midnight- Returns:
- the
LocalTime, ornullif any input isNULL_INT
-
microsOfDayToLocalTime
Converts the number of microseconds from midnight to aLocalTime- Parameters:
micros- microseconds from midnight- Returns:
- the
LocalTime, ornullif any input isNULL_LONG
-
nanosOfDayToLocalTime
Converts the number of nanoseconds from midnight to aLocalTime- Parameters:
nanos- nanoseconds from midnight- Returns:
- the
LocalTime, ornullif any input isNULL_LONG
-
toDate
Deprecated.- Parameters:
instant- the instant to convert- Returns:
- the
Date, ornullifinstantisnull
-
toDate
@Deprecated @Nullable public static @Nullable Date toDate(@Nullable @Nullable ZonedDateTime dateTime) Deprecated.- Parameters:
dateTime- the zoned date time to convert- Returns:
- the
Date, ornullifdateTimeisnull
-
epochNanos
Returns nanoseconds from the Epoch for anInstantvalue.- Parameters:
instant- instant to compute the Epoch offset for- Returns:
- nanoseconds since Epoch, or a NULL_LONG value if the instant is null
-
epochNanos
Returns nanoseconds from the Epoch for aZonedDateTimevalue.- Parameters:
dateTime- the zoned date time to compute the Epoch offset for- Returns:
- nanoseconds since Epoch, or a NULL_LONG value if the zoned date time is null
-
epochMicros
Returns microseconds from the Epoch for anInstantvalue.- Parameters:
instant- instant to compute the Epoch offset for- Returns:
- microseconds since Epoch, or a
NULL_LONGvalue if the instant isnull
-
epochMicros
Returns microseconds from the Epoch for aZonedDateTimevalue.- Parameters:
dateTime- zoned date time to compute the Epoch offset for- Returns:
- microseconds since Epoch, or a
NULL_LONGvalue if the zoned date time isnull
-
epochMillis
Returns milliseconds from the Epoch for anInstantvalue.- Parameters:
instant- instant to compute the Epoch offset for- Returns:
- milliseconds since Epoch, or a
NULL_LONGvalue if the instant isnull
-
epochMillis
Returns milliseconds from the Epoch for aZonedDateTimevalue.- Parameters:
dateTime- zoned date time to compute the Epoch offset for- Returns:
- milliseconds since Epoch, or a
NULL_LONGvalue if the zoned date time isnull
-
epochSeconds
Returns seconds since from the Epoch for anInstantvalue.- Parameters:
instant- instant to compute the Epoch offset for- Returns:
- seconds since Epoch, or a
NULL_LONGvalue if the instant isnull
-
epochSeconds
Returns seconds since from the Epoch for aZonedDateTimevalue.- Parameters:
dateTime- zoned date time to compute the Epoch offset for- Returns:
- seconds since Epoch, or a
NULL_LONGvalue if the zoned date time isnull
-
epochDays
Returns number of days from the Epoch for aLocalDatevalue.- Parameters:
date- date to compute the Epoch offset for- Returns:
- days since Epoch, or a
NULL_LONGvalue if the instant isnull
-
epochDaysAsInt
Returns number of days (as anint) from the Epoch for aLocalDatevalue.- Parameters:
date- date to compute the Epoch offset for- Returns:
- days since Epoch, or a
NULL_INTvalue if the instant isnull
-
epochNanosToInstant
Converts nanoseconds from the Epoch to anInstant.- Parameters:
nanos- nanoseconds since Epoch- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input nanoseconds from the Epoch converted to anInstant
-
epochMicrosToInstant
Converts microseconds from the Epoch to anInstant.- Parameters:
micros- microseconds since Epoch- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input microseconds from the Epoch converted to anInstant
-
epochMillisToInstant
Converts milliseconds from the Epoch to anInstant.- Parameters:
millis- milliseconds since Epoch- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input milliseconds from the Epoch converted to anInstant
-
epochSecondsToInstant
Converts seconds from the Epoch to anInstant.- Parameters:
seconds- seconds since Epoch- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input seconds from the Epoch converted to anInstant
-
epochNanosToZonedDateTime
@ScriptApi @Nullable public static @Nullable ZonedDateTime epochNanosToZonedDateTime(long nanos, ZoneId timeZone) Converts nanoseconds from the Epoch to aZonedDateTime.- Parameters:
nanos- nanoseconds since EpochtimeZone- time zone- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input nanoseconds from the Epoch converted to aZonedDateTime
-
epochMicrosToZonedDateTime
@ScriptApi @Nullable public static @Nullable ZonedDateTime epochMicrosToZonedDateTime(long micros, @Nullable @Nullable ZoneId timeZone) Converts microseconds from the Epoch to aZonedDateTime.- Parameters:
micros- microseconds since EpochtimeZone- time zone- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input microseconds from the Epoch converted to aZonedDateTime
-
epochMillisToZonedDateTime
@ScriptApi @Nullable public static @Nullable ZonedDateTime epochMillisToZonedDateTime(long millis, @Nullable @Nullable ZoneId timeZone) Converts milliseconds from the Epoch to aZonedDateTime.- Parameters:
millis- milliseconds since EpochtimeZone- time zone- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input milliseconds from the Epoch converted to aZonedDateTime
-
epochSecondsToZonedDateTime
@ScriptApi @Nullable public static @Nullable ZonedDateTime epochSecondsToZonedDateTime(long seconds, @Nullable @Nullable ZoneId timeZone) Converts seconds from the Epoch to aZonedDateTime.- Parameters:
seconds- seconds since EpochtimeZone- time zone- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input seconds from the Epoch converted to aZonedDateTime
-
epochAutoToEpochNanos
@ScriptApi public static long epochAutoToEpochNanos(long epochOffset) Converts an offset from the Epoch to a nanoseconds from the Epoch. The offset can be in milliseconds, microseconds, or nanoseconds. Expected date ranges are used to infer the units for the offset.- Parameters:
epochOffset- time offset from the Epoch- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input offset from the Epoch converted to nanoseconds from the Epoch
-
epochAutoToInstant
Converts an offset from the Epoch to anInstant. The offset can be in milliseconds, microseconds, or nanoseconds. Expected date ranges are used to infer the units for the offset.- Parameters:
epochOffset- time offset from the Epoch- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input offset from the Epoch converted to anInstant
-
epochAutoToZonedDateTime
@ScriptApi @Nullable public static @Nullable ZonedDateTime epochAutoToZonedDateTime(long epochOffset, @Nullable @Nullable ZoneId timeZone) Converts an offset from the Epoch to aZonedDateTime. The offset can be in milliseconds, microseconds, or nanoseconds. Expected date ranges are used to infer the units for the offset.- Parameters:
epochOffset- time offset from the EpochtimeZone- time zone- Returns:
nullif any input isnullorQueryConstants.NULL_LONG; otherwise the input offset from the Epoch converted to aZonedDateTime
-
epochDaysToLocalDate
Converts days from the Epoch to aLocalDate.- Parameters:
days- days since Epoch- Returns:
nullif the input isQueryConstants.NULL_LONG; otherwise the input days from the Epoch converted to aLocalDate
-
epochDaysAsIntToLocalDate
Converts days from the Epoch (stored asint) to aLocalDate.- Parameters:
days- days since Epoch- Returns:
nullif the input isQueryConstants.NULL_INT; otherwise the input days from the Epoch converted to aLocalDate
-
toExcelTime
@ScriptApi public static double toExcelTime(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Converts anInstantto an Excel time represented as a double.- Parameters:
instant- instant to converttimeZone- time zone to use when interpreting the instant- Returns:
- 0.0 if either input is
null; otherwise, the input instant converted to an Excel time represented as a double
-
toExcelTime
Converts aZonedDateTimeto an Excel time represented as a double.- Parameters:
dateTime- zoned date time to convert- Returns:
- 0.0 if either input is
null; otherwise, the input zoned date time converted to an Excel time represented as a double
-
excelToInstant
@ScriptApi @Nullable public static @Nullable Instant excelToInstant(double excel, @Nullable @Nullable ZoneId timeZone) Converts an Excel time represented as a double to anInstant.- Parameters:
excel- excel time represented as a doubletimeZone- time zone to use when interpreting the Excel time- Returns:
nullif timeZone isnull; otherwise, the input Excel time converted to anInstant
-
excelToZonedDateTime
@ScriptApi @Nullable public static @Nullable ZonedDateTime excelToZonedDateTime(double excel, @Nullable @Nullable ZoneId timeZone) Converts an Excel time represented as a double to aZonedDateTime.- Parameters:
excel- excel time represented as a doubletimeZone- time zone to use when interpreting the Excel time- Returns:
nullif timeZone isnull; otherwise, the input Excel time converted to aZonedDateTime
-
plusDays
@ScriptApi @Nullable public static @Nullable LocalDate plusDays(@Nullable @Nullable LocalDate date, long days) Adds days to aLocalDate.- Parameters:
date- starting datedays- number of days to add- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting date plus the specified number of days- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant date time exceeds the supported range
-
plus
@ScriptApi @Nullable public static @Nullable LocalDate plus(@Nullable @Nullable LocalDate date, Period period) Adds a time period to aLocalDate.- Parameters:
date- starting dateperiod- time period- Returns:
nullif either input isnull; otherwise the starting date plus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant date time exceeds the supported range
-
plus
@ScriptApi @Nullable public static @Nullable Instant plus(@Nullable @Nullable Instant instant, long nanos) Adds nanoseconds to anInstant.- Parameters:
instant- starting instant valuenanos- number of nanoseconds to add- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting instant plus the specified number of nanoseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant instant exceeds the supported range
-
plus
@ScriptApi @Nullable public static @Nullable ZonedDateTime plus(@Nullable @Nullable ZonedDateTime dateTime, long nanos) Adds nanoseconds to aZonedDateTime.- Parameters:
dateTime- starting zoned date time valuenanos- number of nanoseconds to add- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting zoned date time plus the specified number of nanoseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant zoned date time exceeds the supported range
-
plus
@ScriptApi @Nullable public static @Nullable Instant plus(@Nullable @Nullable Instant instant, @Nullable @Nullable Duration duration) Adds a time period to anInstant.- Parameters:
instant- starting instant valueduration- time period- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting instant plus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant instant exceeds the supported range
-
plus
@ScriptApi @Nullable public static @Nullable Instant plus(@Nullable @Nullable Instant instant, @Nullable @Nullable Period period) Adds a time period to anInstant.- Parameters:
instant- starting instant valueperiod- time period- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting instant plus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant instant exceeds the supported range
-
plus
@ScriptApi @Nullable public static @Nullable ZonedDateTime plus(@Nullable @Nullable ZonedDateTime dateTime, @Nullable @Nullable Duration duration) Adds a time period to aZonedDateTime.- Parameters:
dateTime- starting zoned date time valueduration- time period- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting zoned date time plus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant zoned date time exceeds the supported range
-
plus
@ScriptApi @Nullable public static @Nullable ZonedDateTime plus(@Nullable @Nullable ZonedDateTime dateTime, @Nullable @Nullable Period period) Adds a time period to aZonedDateTime.- Parameters:
dateTime- starting zoned date time valueperiod- time period- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting zoned date time plus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant zoned date time exceeds the supported range
-
minusDays
@ScriptApi @Nullable public static @Nullable LocalDate minusDays(@Nullable @Nullable LocalDate date, long days) Subtracts days from aLocalDate.- Parameters:
date- starting datedays- number of days to subtract- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting date plus the specified number of days- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant date time exceeds the supported range
-
minus
@ScriptApi @Nullable public static @Nullable LocalDate minus(@Nullable @Nullable LocalDate date, Period period) Subtracts a time period from aLocalDate.- Parameters:
date- starting dateperiod- time period- Returns:
nullif either input isnull; otherwise the starting date minus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant date time exceeds the supported range
-
minus
@ScriptApi @Nullable public static @Nullable Instant minus(@Nullable @Nullable Instant instant, long nanos) Subtracts nanoseconds from anInstant.- Parameters:
instant- starting instant valuenanos- number of nanoseconds to subtract- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting instant minus the specified number of nanoseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant instant exceeds the supported range
-
minus
@ScriptApi @Nullable public static @Nullable ZonedDateTime minus(@Nullable @Nullable ZonedDateTime dateTime, long nanos) Subtracts nanoseconds from aZonedDateTime.- Parameters:
dateTime- starting zoned date time valuenanos- number of nanoseconds to subtract- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting zoned date time minus the specified number of nanoseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant zoned date time exceeds the supported range
-
minus
@ScriptApi @Nullable public static @Nullable Instant minus(@Nullable @Nullable Instant instant, @Nullable @Nullable Duration duration) Subtracts a time period to anInstant.- Parameters:
instant- starting instant valueduration- time period- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting instant minus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant instant exceeds the supported range
-
minus
@ScriptApi @Nullable public static @Nullable Instant minus(@Nullable @Nullable Instant instant, @Nullable @Nullable Period period) Subtracts a time period to anInstant.- Parameters:
instant- starting instant valueperiod- time period- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting instant minus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant instant exceeds the supported range
-
minus
@ScriptApi @Nullable public static @Nullable ZonedDateTime minus(@Nullable @Nullable ZonedDateTime dateTime, @Nullable @Nullable Duration duration) Subtracts a time period to aZonedDateTime.- Parameters:
dateTime- starting zoned date time valueduration- time period- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting zoned date time minus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant zoned date time exceeds the supported range
-
minus
@ScriptApi @Nullable public static @Nullable ZonedDateTime minus(@Nullable @Nullable ZonedDateTime dateTime, @Nullable @Nullable Period period) Subtracts a time period to aZonedDateTime.- Parameters:
dateTime- starting zoned date time valueperiod- time period- Returns:
nullif either input isnullorQueryConstants.NULL_LONG; otherwise the starting zoned date time minus the specified time period- Throws:
DateTimeUtils.DateTimeOverflowException- if the resultant zoned date time exceeds the supported range
-
minus
@ScriptApi public static long minus(@Nullable @Nullable Instant instant1, @Nullable @Nullable Instant instant2) Subtract one instant from another and return the difference in nanoseconds.- Parameters:
instant1- first instantinstant2- second instant- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise the difference in instant1 and instant2 in nanoseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
minus
@ScriptApi public static long minus(@Nullable @Nullable ZonedDateTime dateTime1, @Nullable @Nullable ZonedDateTime dateTime2) Subtract one zoned date time from another and return the difference in nanoseconds.- Parameters:
dateTime1- first zoned date timedateTime2- second zoned date time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise the difference in dateTime1 and dateTime2 in nanoseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffNanos
@ScriptApi public static long diffNanos(@Nullable @Nullable Instant start, @Nullable @Nullable Instant end) Returns the difference in nanoseconds between two instant values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise the difference in start and end in nanoseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffNanos
@ScriptApi public static long diffNanos(@Nullable @Nullable ZonedDateTime start, @Nullable @Nullable ZonedDateTime end) Returns the difference in nanoseconds between two zoned date time values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise the difference in start and end in nanoseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffMicros
@ScriptApi public static long diffMicros(@Nullable @Nullable Instant start, @Nullable @Nullable Instant end) Returns the difference in microseconds between two instant values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise the difference in start and end in microseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffMicros
@ScriptApi public static long diffMicros(@Nullable @Nullable ZonedDateTime start, @Nullable @Nullable ZonedDateTime end) Returns the difference in microseconds between two zoned date time values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise the difference in start and end in microseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffMillis
@ScriptApi public static long diffMillis(@Nullable @Nullable Instant start, @Nullable @Nullable Instant end) Returns the difference in milliseconds between two instant values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise the difference in start and end in milliseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffMillis
@ScriptApi public static long diffMillis(@Nullable @Nullable ZonedDateTime start, @Nullable @Nullable ZonedDateTime end) Returns the difference in milliseconds between two zoned date time values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise the difference in start and end in milliseconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffSeconds
@ScriptApi public static double diffSeconds(@Nullable @Nullable Instant start, @Nullable @Nullable Instant end) Returns the difference in seconds between two instant values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in seconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffSeconds
@ScriptApi public static double diffSeconds(@Nullable @Nullable ZonedDateTime start, @Nullable @Nullable ZonedDateTime end) Returns the difference in seconds between two zoned date time values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in seconds- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffMinutes
@ScriptApi public static double diffMinutes(@Nullable @Nullable Instant start, @Nullable @Nullable Instant end) Returns the difference in minutes between two instant values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in minutes- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffMinutes
@ScriptApi public static double diffMinutes(@Nullable @Nullable ZonedDateTime start, @Nullable @Nullable ZonedDateTime end) Returns the difference in minutes between two zoned date time values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in minutes- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffDays
@ScriptApi public static double diffDays(@Nullable @Nullable Instant start, @Nullable @Nullable Instant end) Returns the difference in days between two instant values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in days- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffDays
@ScriptApi public static double diffDays(@Nullable @Nullable ZonedDateTime start, @Nullable @Nullable ZonedDateTime end) Returns the difference in days between two zoned date time values.- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in days- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffYears365
@ScriptApi public static double diffYears365(@Nullable @Nullable Instant start, @Nullable @Nullable Instant end) Returns the difference in years between two instant values.Years are defined in terms of 365 day years.
- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in years- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffYears365
@ScriptApi public static double diffYears365(@Nullable @Nullable ZonedDateTime start, @Nullable @Nullable ZonedDateTime end) Returns the difference in years between two zoned date time values.Years are defined in terms of 365 day years.
- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in years- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffYearsAvg
@ScriptApi public static double diffYearsAvg(@Nullable @Nullable Instant start, @Nullable @Nullable Instant end) Returns the difference in years between two instant values.Years are defined in terms of 365.2425 day years.
- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in years- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
diffYearsAvg
@ScriptApi public static double diffYearsAvg(@Nullable @Nullable ZonedDateTime start, @Nullable @Nullable ZonedDateTime end) Returns the difference in years between two zoned date time values.Years are defined in terms of 365.2425 day years.
- Parameters:
start- start timeend- end time- Returns:
QueryConstants.NULL_DOUBLEif either input isnull; otherwise the difference in start and end in years- Throws:
DateTimeUtils.DateTimeOverflowException- if the datetime arithmetic overflows or underflows
-
isBefore
@ScriptApi public static boolean isBefore(@Nullable @Nullable Instant instant1, @Nullable @Nullable Instant instant2) Evaluates whether one instant value is before a second instant value.- Parameters:
instant1- first instantinstant2- second instant- Returns:
trueif instant1 is before instant2; otherwise,falseif either value isnullor if instant2 is equal to or before instant1
-
isBefore
@ScriptApi public static boolean isBefore(@Nullable @Nullable ZonedDateTime dateTime1, @Nullable @Nullable ZonedDateTime dateTime2) Evaluates whether one zoned date time value is before a second zoned date time value.- Parameters:
dateTime1- first zoned date timedateTime2- second zoned date time- Returns:
trueif dateTime1 is before dateTime2; otherwise,falseif either value isnullor if dateTime2 is equal to or before dateTime1
-
isBeforeOrEqual
@ScriptApi public static boolean isBeforeOrEqual(@Nullable @Nullable Instant instant1, @Nullable @Nullable Instant instant2) Evaluates whether one instant value is before or equal to a second instant value.- Parameters:
instant1- first instantinstant2- second instant- Returns:
trueif instant1 is before or equal to instant2; otherwise,falseif either value isnullor if instant2 is before instant1
-
isBeforeOrEqual
@ScriptApi public static boolean isBeforeOrEqual(@Nullable @Nullable ZonedDateTime dateTime1, @Nullable @Nullable ZonedDateTime dateTime2) Evaluates whether one zoned date time value is before or equal to a second zoned date time value.- Parameters:
dateTime1- first zoned date timedateTime2- second zoned date time- Returns:
trueif dateTime1 is before or equal to dateTime2; otherwise,falseif either value isnullor if dateTime2 is before dateTime1
-
isAfter
@ScriptApi public static boolean isAfter(@Nullable @Nullable Instant instant1, @Nullable @Nullable Instant instant2) Evaluates whether one instant value is after a second instant value.- Parameters:
instant1- first instantinstant2- second instant- Returns:
trueif instant1 is after instant2; otherwise,falseif either value isnullor if instant2 is equal to or after instant1
-
isAfter
@ScriptApi public static boolean isAfter(@Nullable @Nullable ZonedDateTime dateTime1, @Nullable @Nullable ZonedDateTime dateTime2) Evaluates whether one zoned date time value is after a second zoned date time value.- Parameters:
dateTime1- first zoned date timedateTime2- second zoned date time- Returns:
trueif dateTime1 is after dateTime2; otherwise,falseif either value isnullor if dateTime2 is equal to or after dateTime1
-
isAfterOrEqual
@ScriptApi public static boolean isAfterOrEqual(@Nullable @Nullable Instant instant1, @Nullable @Nullable Instant instant2) Evaluates whether one instant value is after or equal to a second instant value.- Parameters:
instant1- first instantinstant2- second instant- Returns:
trueif instant1 is after or equal to instant2; otherwise,falseif either value isnullor if instant2 is after instant1
-
isAfterOrEqual
@ScriptApi public static boolean isAfterOrEqual(@Nullable @Nullable ZonedDateTime dateTime1, @Nullable @Nullable ZonedDateTime dateTime2) Evaluates whether one zoned date time value is after or equal to a second zoned date time value.- Parameters:
dateTime1- first zoned date timedateTime2- second zoned date time- Returns:
trueif dateTime1 is after or equal to dateTime2; otherwise,falseif either value isnullor if dateTime2 is after dateTime1
-
nanosOfMilli
Returns the number of nanoseconds that have elapsed since the top of the millisecond.- Parameters:
instant- time- Returns:
QueryConstants.NULL_INTif the input isnull; otherwise, number of nanoseconds that have elapsed since the top of the millisecond
-
nanosOfMilli
Returns the number of nanoseconds that have elapsed since the top of the millisecond.- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_INTif the input isnull; otherwise, number of nanoseconds that have elapsed since the top of the millisecond
-
microsOfMilli
Returns the number of microseconds that have elapsed since the top of the millisecond. Nanoseconds are rounded, not dropped -- '20:41:39.123456700' has 457 micros, not 456.- Parameters:
instant- time- Returns:
QueryConstants.NULL_INTif the input isnull; otherwise, number of microseconds that have elapsed since the top of the millisecond
-
microsOfMilli
Returns the number of microseconds that have elapsed since the top of the millisecond. Nanoseconds are rounded, not dropped -- '20:41:39.123456700' has 457 micros, not 456.- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_INTif the input isnull; otherwise, number of microseconds that have elapsed since the top of the millisecond
-
nanosOfSecond
@ScriptApi public static long nanosOfSecond(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns the number of nanoseconds that have elapsed since the top of the second.- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise, number of nanoseconds that have elapsed since the top of the second
-
nanosOfSecond
Returns the number of nanoseconds that have elapsed since the top of the second.- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise, number of nanoseconds that have elapsed since the top of the second
-
microsOfSecond
@ScriptApi public static long microsOfSecond(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns the number of microseconds that have elapsed since the top of the second.- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise, number of microseconds that have elapsed since the top of the second
-
microsOfSecond
Returns the number of microseconds that have elapsed since the top of the second.- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise, number of microseconds that have elapsed since the top of the second
-
millisOfSecond
@ScriptApi public static int millisOfSecond(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns the number of milliseconds that have elapsed since the top of the second.- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of milliseconds that have elapsed since the top of the second
-
millisOfSecond
Returns the number of milliseconds that have elapsed since the top of the second.- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of milliseconds that have elapsed since the top of the second
-
secondOfMinute
@ScriptApi public static int secondOfMinute(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns the number of seconds that have elapsed since the top of the minute.- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of seconds that have elapsed since the top of the minute
-
secondOfMinute
Returns the number of seconds that have elapsed since the top of the minute.- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of seconds that have elapsed since the top of the minute
-
minuteOfHour
@ScriptApi public static int minuteOfHour(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns the number of minutes that have elapsed since the top of the hour.- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of minutes that have elapsed since the top of the hour
-
minuteOfHour
Returns the number of minutes that have elapsed since the top of the hour.- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of minutes that have elapsed since the top of the hour
-
nanosOfDay
@ScriptApi @Deprecated public static long nanosOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Deprecated.UsenanosOfDay(Instant, ZoneId, boolean)instead. To be removed soon.Returns the number of nanoseconds that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise, number of nanoseconds that have elapsed since the top of the day
-
nanosOfDay
Deprecated.UsenanosOfDay(ZonedDateTime, boolean)instead. To be removed soon.Returns the number of nanoseconds that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise, number of nanoseconds that have elapsed since the top of the day
-
millisOfDay
@ScriptApi @Deprecated public static int millisOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Deprecated.UsemillisOfDay(Instant, ZoneId, boolean)instead. To be removed soon.Returns the number of milliseconds that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of milliseconds that have elapsed since the top of the day
-
millisOfDay
Deprecated.UsemillisOfDay(ZonedDateTime, boolean)instead. To be removed soon.Returns the number of milliseconds that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of milliseconds that have elapsed since the top of the day
-
secondOfDay
@ScriptApi @Deprecated public static int secondOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Deprecated.UsesecondOfDay(Instant, ZoneId, boolean)instead. To be removed soon.Returns the number of seconds that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of seconds that have elapsed since the top of the day
-
secondOfDay
Deprecated.UsesecondOfDay(ZonedDateTime, boolean)instead. To be removed soon.Returns the number of seconds that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of seconds that have elapsed since the top of the day
-
minuteOfDay
@ScriptApi @Deprecated public static int minuteOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Deprecated.UseminuteOfDay(Instant, ZoneId, boolean)instead. To be removed soon.Returns the number of minutes that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of minutes that have elapsed since the top of the day
-
minuteOfDay
Deprecated.UseminuteOfDay(ZonedDateTime, boolean)instead. To be removed soon.Returns the number of minutes that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of minutes that have elapsed since the top of the day
-
hourOfDay
@ScriptApi @Deprecated public static int hourOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Deprecated.UsehourOfDay(Instant, ZoneId, boolean)instead. To be removed soon.Returns the number of hours that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
instant- timetimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of hours that have elapsed since the top of the day
-
hourOfDay
Deprecated.UsehourOfDay(ZonedDateTime, boolean)instead. To be removed soon.Returns the number of hours that have elapsed since the top of the day.On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards.
- Parameters:
dateTime- time- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of hours that have elapsed since the top of the day
-
nanosOfDay
@ScriptApi public static long nanosOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone, boolean localTime) Returns the number of nanoseconds that have elapsed since the start of the day.- Parameters:
instant- timetimeZone- time zonelocalTime- iftrue, returns the number of nanos from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of nanos from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise, number of nanoseconds that have elapsed since the start of the day
-
nanosOfDay
@ScriptApi public static long nanosOfDay(@Nullable @Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of nanoseconds that have elapsed since the start of the day.- Parameters:
dateTime- timelocalTime- iftrue, returns the number of nanos from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of nanos from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_LONGif either input isnull; otherwise, number of nanoseconds that have elapsed since the start of the day
-
nanosOfDay
Returns the number of nanoseconds that have elapsed since the start of the day.- Parameters:
localTime- time- Returns:
QueryConstants.NULL_LONGif input isnull; otherwise, number of nanoseconds that have elapsed since the start of the day
-
millisOfDay
@ScriptApi public static int millisOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone, boolean localTime) Returns the number of milliseconds that have elapsed since the start of the day.- Parameters:
instant- timetimeZone- time zonelocalTime- iftrue, returns the number of milliseconds from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of milliseconds from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of milliseconds that have elapsed since the start of the day
-
millisOfDay
@ScriptApi public static int millisOfDay(@Nullable @Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of milliseconds that have elapsed since the start of the day.- Parameters:
dateTime- timelocalTime- iftrue, returns the number of milliseconds from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of milliseconds from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of milliseconds that have elapsed since the start of the day
-
millisOfDay
Returns the number of milliseconds that have elapsed since the start of the day.- Parameters:
localTime- time- Returns:
QueryConstants.NULL_INTif input isnull; otherwise, number of milliseconds that have elapsed since the start of the day
-
secondOfDay
@ScriptApi public static int secondOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone, boolean localTime) Returns the number of seconds that have elapsed since the start of the day.- Parameters:
instant- timetimeZone- time zonelocalTime- iftrue, returns the number of nanos from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of nanos from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of seconds that have elapsed since the start of the day
-
secondOfDay
@ScriptApi public static int secondOfDay(@Nullable @Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of seconds that have elapsed since the start of the day.- Parameters:
dateTime- timelocalTime- iftrue, returns the number of seconds from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of seconds from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of seconds that have elapsed since the start of the day
-
secondOfDay
Returns the number of seconds that have elapsed since the start of the day.- Parameters:
localTime- time- Returns:
QueryConstants.NULL_INTif input isnull; otherwise, number of seconds that have elapsed since the start of the day
-
minuteOfDay
@ScriptApi public static int minuteOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone, boolean localTime) Returns the number of minutes that have elapsed since the start of the day.- Parameters:
instant- timetimeZone- time zonelocalTime- iftrue, returns the number of minutes from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of minutes from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of minutes that have elapsed since the start of the day
-
minuteOfDay
@ScriptApi public static int minuteOfDay(@Nullable @Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of minutes that have elapsed since the start of the day.- Parameters:
dateTime- timelocalTime- iftrue, returns the number of minutes from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of minutes from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of minutes that have elapsed since the start of the day
-
minuteOfDay
Returns the number of minutes that have elapsed since the start of the day.- Parameters:
localTime- time- Returns:
QueryConstants.NULL_INTif input isnull; otherwise, number of minutes that have elapsed since the start of the day
-
hourOfDay
@ScriptApi public static int hourOfDay(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone, boolean localTime) Returns the number of hours that have elapsed since the start of the day.- Parameters:
instant- timetimeZone- time zonelocalTime- iftrue, returns the number of hours from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of hours from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of hours that have elapsed since the start of the day
-
hourOfDay
@ScriptApi public static int hourOfDay(@Nullable @Nullable ZonedDateTime dateTime, boolean localTime) Returns the number of hours that have elapsed since the start of the day.- Parameters:
dateTime- timelocalTime- iftrue, returns the number of hours from the start of the day according to the local time. In this case, 9:30AM always returns the same value. Iffalse, returns the number of hours from the start of the day. On days when daylight savings time events occur, results may be different from what is expected based upon the local time. For example, on daylight savings time change days, 9:30AM may be earlier or later in the day based upon if the daylight savings time adjustment is forwards or backwards. On non DST days, the result is the same as if localTime is false.- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, number of hours that have elapsed since the start of the day
-
hourOfDay
Returns the number of hours that have elapsed since the start of the day.- Parameters:
localTime- time- Returns:
QueryConstants.NULL_INTif input isnull; otherwise, number of hours that have elapsed since the start of the day
-
dayOfWeek
Returns athe day of the week for aZonedDateTimein the specified time zone.- Parameters:
date- date to find the day of the week of- Returns:
nullif either input isnull; otherwise, the day of the week
-
dayOfWeek
@ScriptApi public static DayOfWeek dayOfWeek(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns the day of the week for anInstantin the specified time zone.- Parameters:
instant- time to find the day of the week oftimeZone- time zone- Returns:
nullif either input isnull; otherwise, the day of the week
-
dayOfWeek
Returns the day of the week for aZonedDateTimein the specified time zone.- Parameters:
dateTime- time to find the day of the week of- Returns:
nullif either input isnull; otherwise, the day of the week
-
dayOfWeekValue
Returns a 1-based int value of the day of the week for aZonedDateTimein the specified time zone, with 1 being Monday and 7 being Sunday.- Parameters:
date- date to find the day of the week of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the day of the week
-
dayOfWeekValue
@ScriptApi public static int dayOfWeekValue(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns a 1-based int value of the day of the week for anInstantin the specified time zone, with 1 being Monday and 7 being Sunday.- Parameters:
instant- time to find the day of the week oftimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the day of the week
-
dayOfWeekValue
Returns a 1-based int value of the day of the week for aZonedDateTimein the specified time zone, with 1 being Monday and 7 being Sunday.- Parameters:
dateTime- time to find the day of the week of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the day of the week
-
dayOfMonth
Returns a 1-based int value of the day of the month for aZonedDateTimeand specified time zone. The first day of the month returns 1, the second day returns 2, etc.- Parameters:
date- date to find the day of the month of- Returns:
- A
QueryConstants.NULL_INTif either input isnull; otherwise, the day of the month
-
dayOfMonth
@ScriptApi public static int dayOfMonth(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns a 1-based int value of the day of the month for anInstantand specified time zone. The first day of the month returns 1, the second day returns 2, etc.- Parameters:
instant- time to find the day of the month oftimeZone- time zone- Returns:
- A
QueryConstants.NULL_INTif either input isnull; otherwise, the day of the month
-
dayOfMonth
Returns a 1-based int value of the day of the month for aZonedDateTimeand specified time zone. The first day of the month returns 1, the second day returns 2, etc.- Parameters:
dateTime- time to find the day of the month of- Returns:
- A
QueryConstants.NULL_INTif either input isnull; otherwise, the day of the month
-
dayOfYear
Returns a 1-based int value of the day of the year (Julian date) for aZonedDateTimein the specified time zone. The first day of the year returns 1, the second day returns 2, etc.- Parameters:
date- date to find the day of the year of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the day of the year
-
dayOfYear
@ScriptApi public static int dayOfYear(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns a 1-based int value of the day of the year (Julian date) for anInstantin the specified time zone. The first day of the year returns 1, the second day returns 2, etc.- Parameters:
instant- time to find the day of the year oftimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the day of the year
-
dayOfYear
Returns a 1-based int value of the day of the year (Julian date) for aZonedDateTimein the specified time zone. The first day of the year returns 1, the second day returns 2, etc.- Parameters:
dateTime- time to find the day of the year of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the day of the year
-
monthOfYear
Returns a 1-based int value of the month of the year (Julian date) for aLocalDate. January is 1, February is 2, etc.- Parameters:
date- date to find the month of the year of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the month of the year
-
monthOfYear
@ScriptApi public static int monthOfYear(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns a 1-based int value of the month of the year (Julian date) for anInstantin the specified time zone. January is 1, February is 2, etc.- Parameters:
instant- time to find the month of the year oftimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the month of the year
-
monthOfYear
Returns a 1-based int value of the month of the year (Julian date) for aZonedDateTimein the specified time zone. January is 1, February is 2, etc.- Parameters:
dateTime- time to find the month of the year of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the month of the year
-
year
Returns the year for aLocalDate.- Parameters:
date- date to find the year of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the year
-
year
@ScriptApi public static int year(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns the year for anInstantin the specified time zone.- Parameters:
instant- time to find the year oftimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the year
-
year
Returns the year for aZonedDateTimein the specified time zone.- Parameters:
dateTime- time to find the year of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the year
-
yearOfCentury
Returns the year of the century (two-digit year) for aLocalDatein the specified time zone.- Parameters:
date- date to find the year of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the year of the century (two-digit year)
-
yearOfCentury
@ScriptApi public static int yearOfCentury(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns the year of the century (two-digit year) for anInstantin the specified time zone.- Parameters:
instant- time to find the year oftimeZone- time zone- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the year of the century (two-digit year)
-
yearOfCentury
Returns the year of the century (two-digit year) for aZonedDateTimein the specified time zone.- Parameters:
dateTime- time to find the day of the month of- Returns:
QueryConstants.NULL_INTif either input isnull; otherwise, the year of the century (two-digit year)
-
atMidnight
@ScriptApi @Nullable public static @Nullable ZonedDateTime atMidnight(@Nullable @Nullable LocalDate date, @Nullable @Nullable ZoneId timeZone) Returns anZonedDateTimefor the prior midnight in the specified time zone.- Parameters:
date- date to compute the prior midnight fortimeZone- time zone- Returns:
nullif either input isnull; otherwise anZonedDateTimerepresenting the prior midnight in the specified time zone
-
atMidnight
@ScriptApi @Nullable public static @Nullable Instant atMidnight(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns anInstantfor the prior midnight in the specified time zone.- Parameters:
instant- time to compute the prior midnight fortimeZone- time zone- Returns:
nullif either input isnull; otherwise anInstantrepresenting the prior midnight in the specified time zone
-
atMidnight
@ScriptApi @Nullable public static @Nullable ZonedDateTime atMidnight(@Nullable @Nullable ZonedDateTime dateTime) Returns aZonedDateTimefor the prior midnight in the specified time zone.- Parameters:
dateTime- time to compute the prior midnight for- Returns:
nullif either input isnull; otherwise aZonedDateTimerepresenting the prior midnight in the specified time zone
-
lowerBin
@ScriptApi @Nullable public static @Nullable Instant lowerBin(@Nullable @Nullable Instant instant, long intervalNanos) Returns anInstantvalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalNanosvalue would return the instant value for the start of the five-minute window that contains the input instant.- Parameters:
instant- instant for which to evaluate the start of the containing windowintervalNanos- size of the window in nanoseconds- Returns:
nullif either input isnull; otherwise, anInstantrepresenting the start of the window
-
lowerBin
@ScriptApi @Nullable public static @Nullable Instant lowerBin(@Nullable @Nullable Instant instant, Duration interval) Returns anInstantvalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalvalue would return the instant value for the start of the five-minute window that contains the input instant.- Parameters:
instant- instant for which to evaluate the start of the containing windowinterval- size of the window- Returns:
nullif either input isnull; otherwise, anInstantrepresenting the start of the window
-
lowerBin
@ScriptApi @Nullable public static @Nullable ZonedDateTime lowerBin(@Nullable @Nullable ZonedDateTime dateTime, long intervalNanos) Returns aZonedDateTimevalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalNanosvalue would return the zoned date time value for the start of the five-minute window that contains the input zoned date time.- Parameters:
dateTime- zoned date time for which to evaluate the start of the containing windowintervalNanos- size of the window in nanoseconds- Returns:
nullif either input isnull; otherwise, aZonedDateTimerepresenting the start of the window
-
lowerBin
@ScriptApi @Nullable public static @Nullable ZonedDateTime lowerBin(@Nullable @Nullable ZonedDateTime dateTime, Duration interval) Returns aZonedDateTimevalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalvalue would return the zoned date time value for the start of the five-minute window that contains the input zoned date time.- Parameters:
dateTime- zoned date time for which to evaluate the start of the containing windowinterval- size of the window- Returns:
nullif either input isnull; otherwise, aZonedDateTimerepresenting the start of the window
-
lowerBin
@ScriptApi @Nullable public static @Nullable Instant lowerBin(@Nullable @Nullable Instant instant, long intervalNanos, long offset) Returns anInstantvalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalNanosvalue would return the instant value for the start of the five-minute window that contains the input instant.- Parameters:
instant- instant for which to evaluate the start of the containing windowintervalNanos- size of the window in nanosecondsoffset- The window start offset in nanoseconds. For example, a value of MINUTE would offset all windows by one minute.- Returns:
nullif any input isnull; otherwise, anInstantrepresenting the start of the window
-
lowerBin
@ScriptApi @Nullable public static @Nullable Instant lowerBin(@Nullable @Nullable Instant instant, Duration interval, Duration offset) Returns anInstantvalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalvalue would return the instant value for the start of the five-minute window that contains the input instant.- Parameters:
instant- instant for which to evaluate the start of the containing windowinterval- size of the windowoffset- The window start offset. For example, a value of 'PT1m' would offset all windows by one minute.- Returns:
nullif any input isnull; otherwise, anInstantrepresenting the start of the window
-
lowerBin
@ScriptApi @Nullable public static @Nullable ZonedDateTime lowerBin(@Nullable @Nullable ZonedDateTime dateTime, long intervalNanos, long offset) Returns aZonedDateTimevalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalNanosvalue would return the zoned date time value for the start of the five-minute window that contains the input zoned date time.- Parameters:
dateTime- zoned date time for which to evaluate the start of the containing windowintervalNanos- size of the window in nanosecondsoffset- The window start offset in nanoseconds. For example, a value of MINUTE would offset all windows by one minute.- Returns:
nullif any input isnull; otherwise, aZonedDateTimerepresenting the start of the window
-
lowerBin
@ScriptApi @Nullable public static @Nullable ZonedDateTime lowerBin(@Nullable @Nullable ZonedDateTime dateTime, Duration interval, Duration offset) Returns aZonedDateTimevalue, which is at the starting (lower) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalintervalNanos value would return the zoned date time value for the start of the five-minute window that contains the input zoned date time.- Parameters:
dateTime- zoned date time for which to evaluate the start of the containing windowinterval- size of the windowoffset- The window start offset. For example, a value of MINUTE would offset all windows by one minute.- Returns:
nullif any input isnull; otherwise, aZonedDateTimerepresenting the start of the window
-
upperBin
@ScriptApi @Nullable public static @Nullable Instant upperBin(@Nullable @Nullable Instant instant, long intervalNanos) Returns anInstantvalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalNanosvalue would return the instant value for the end of the five-minute window that contains the input instant.- Parameters:
instant- instant for which to evaluate the start of the containing windowintervalNanos- size of the window in nanoseconds- Returns:
nullif either input isnull; otherwise, anInstantrepresenting the end of the window
-
upperBin
@ScriptApi @Nullable public static @Nullable Instant upperBin(@Nullable @Nullable Instant instant, Duration interval) Returns anInstantvalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalvalue would return the instant value for the end of the five-minute window that contains the input instant.- Parameters:
instant- instant for which to evaluate the start of the containing windowinterval- size of the window- Returns:
nullif either input isnull; otherwise, anInstantrepresenting the end of the window
-
upperBin
@ScriptApi @Nullable public static @Nullable ZonedDateTime upperBin(@Nullable @Nullable ZonedDateTime dateTime, long intervalNanos) Returns aZonedDateTimevalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalNanosvalue would return the zoned date time value for the end of the five-minute window that contains the input zoned date time.- Parameters:
dateTime- zoned date time for which to evaluate the start of the containing windowintervalNanos- size of the window in nanoseconds- Returns:
nullif either input isnull; otherwise, aZonedDateTimerepresenting the end of the window
-
upperBin
@ScriptApi @Nullable public static @Nullable ZonedDateTime upperBin(@Nullable @Nullable ZonedDateTime dateTime, Duration interval) Returns aZonedDateTimevalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalvalue would return the zoned date time value for the end of the five-minute window that contains the input zoned date time.- Parameters:
dateTime- zoned date time for which to evaluate the start of the containing windowinterval- size of the window- Returns:
nullif either input isnull; otherwise, aZonedDateTimerepresenting the end of the window
-
upperBin
@ScriptApi @Nullable public static @Nullable Instant upperBin(@Nullable @Nullable Instant instant, long intervalNanos, long offset) Returns anInstantvalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalNanosvalue would return the instant value for the end of the five-minute window that contains the input instant.- Parameters:
instant- instant for which to evaluate the start of the containing windowintervalNanos- size of the window in nanosecondsoffset- The window start offset in nanoseconds. For example, a value of MINUTE would offset all windows by one minute.- Returns:
nullif any input isnull; otherwise, anInstantrepresenting the end of the window
-
upperBin
@ScriptApi @Nullable public static @Nullable Instant upperBin(@Nullable @Nullable Instant instant, Duration interval, Duration offset) Returns anInstantvalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalvalue would return the instant value for the end of the five-minute window that contains the input instant.- Parameters:
instant- instant for which to evaluate the start of the containing windowinterval- size of the windowoffset- The window start offset. For example, a value of 'PT1m' would offset all windows by one minute.- Returns:
nullif any input isnull; otherwise, anInstantrepresenting the end of the window
-
upperBin
@ScriptApi @Nullable public static @Nullable ZonedDateTime upperBin(@Nullable @Nullable ZonedDateTime dateTime, long intervalNanos, long offset) Returns aZonedDateTimevalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalNanosvalue would return the zoned date time value for the end of the five-minute window that contains the input zoned date time.- Parameters:
dateTime- zoned date time for which to evaluate the start of the containing windowintervalNanos- size of the window in nanosecondsoffset- The window start offset in nanoseconds. For example, a value of MINUTE would offset all windows by one minute.- Returns:
nullif any input isnull; otherwise, aZonedDateTimerepresenting the end of the window
-
upperBin
@ScriptApi @Nullable public static @Nullable ZonedDateTime upperBin(@Nullable @Nullable ZonedDateTime dateTime, Duration interval, Duration offset) Returns aZonedDateTimevalue, which is at the ending (upper) end of a time range defined by the interval nanoseconds. For example, a five-minuteintervalvalue would return the zoned date time value for the end of the five-minute window that contains the input zoned date time.- Parameters:
dateTime- zoned date time for which to evaluate the start of the containing windowinterval- size of the windowoffset- The window start offset. For example, a value of 'PT1m' would offset all windows by one minute.- Returns:
nullif any input isnull; otherwise, aZonedDateTimerepresenting the end of the window
-
formatDurationNanos
Returns a nanosecond duration formatted as a "[-]PThhh:mm:ss.nnnnnnnnn" string.- Parameters:
nanos- nanoseconds, ornullif the input isQueryConstants.NULL_LONG- Returns:
- the nanosecond duration formatted as a "[-]PThhh:mm:ss.nnnnnnnnn" string
-
formatDateTime
@ScriptApi @Nullable public static @Nullable String formatDateTime(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns anInstantformatted as a "yyyy-MM-ddThh:mm:ss.SSSSSSSSS TZ" string.- Parameters:
instant- time to format as a stringtimeZone- time zone to use when formatting the string.- Returns:
nullif either input isnull; otherwise, the time formatted as a "yyyy-MM-ddThh:mm:ss.nnnnnnnnn TZ" string
-
formatDateTime
@ScriptApi @Nullable public static @Nullable String formatDateTime(@Nullable @Nullable ZonedDateTime dateTime) Returns aZonedDateTimeformatted as a "yyyy-MM-ddThh:mm:ss.SSSSSSSSS TZ" string.- Parameters:
dateTime- time to format as a string- Returns:
nullif either input isnull; otherwise, the time formatted as a "yyyy-MM-ddThh:mm:ss.nnnnnnnnn TZ" string
-
formatDate
@ScriptApi @Nullable public static @Nullable String formatDate(@Nullable @Nullable Instant instant, @Nullable @Nullable ZoneId timeZone) Returns anInstantformatted as a "yyyy-MM-dd" string.- Parameters:
instant- time to format as a stringtimeZone- time zone to use when formatting the string.- Returns:
nullif either input isnull; otherwise, the time formatted as a "yyyy-MM-dd" string
-
formatDate
@ScriptApi @Nullable public static @Nullable String formatDate(@Nullable @Nullable ZonedDateTime dateTime) Returns aZonedDateTimeformatted as a "yyyy-MM-dd" string.- Parameters:
dateTime- time to format as a string- Returns:
nullif either input isnull; otherwise, the time formatted as a "yyyy-MM-dd" string
-
formatDate
Returns aLocalDateformatted as a "yyyy-MM-dd" string.- Parameters:
date- date to format as a string- Returns:
nullif either input isnull; otherwise, the time formatted as a "yyyy-MM-dd" string
-
parseTimeZone
Parses the string argument as a time zone.- Parameters:
s- string to be converted- Returns:
- a
ZoneIdrepresented by the input string - Throws:
DateTimeUtils.DateTimeParseException- if the string cannot be converted- See Also:
-
parseTimeZoneQuiet
@ScriptApi @Nullable public static @Nullable ZoneId parseTimeZoneQuiet(@Nullable @Nullable String s) Parses the string argument as a time zone.- Parameters:
s- string to be converted- Returns:
- a
ZoneIdrepresented by the input string, ornullif the string can not be parsed - See Also:
-
parseDurationNanos
Parses the string argument as a time duration in nanoseconds.Time duration strings can be formatted as
[-]PT[-]hh:mm:[ss.nnnnnnnnn]or as a duration string formatted as[-]PnDTnHnMn.nS.- Parameters:
s- string to be converted- Returns:
- the number of nanoseconds represented by the string
- Throws:
DateTimeUtils.DateTimeParseException- if the string cannot be parsed- See Also:
-
parseDurationNanosQuiet
Parses the string argument as a time duration in nanoseconds.Time duration strings can be formatted as
[-]PT[-]hh:mm:[ss.nnnnnnnnn]or as a duration string formatted as[-]PnDTnHnMn.nS.- Parameters:
s- string to be converted- Returns:
- the number of nanoseconds represented by the string, or
QueryConstants.NULL_LONGif the string cannot be parsed - See Also:
-
parsePeriod
Parses the string argument as a period, which is a unit of time in terms of calendar time (days, weeks, months, years, etc.).Period strings are formatted according to the ISO-8601 duration format as
PnYnMnDandPnW, where the coefficients can be positive or negative. Zero coefficients can be omitted. Optionally, the string can begin with a negative sign.Examples:
"P2Y" -- Period.ofYears(2) "P3M" -- Period.ofMonths(3) "P4W" -- Period.ofWeeks(4) "P5D" -- Period.ofDays(5) "P1Y2M3D" -- Period.of(1, 2, 3) "P1Y2M3W4D" -- Period.of(1, 2, 25) "P-1Y2M" -- Period.of(-1, 2, 0) "-P1Y2M" -- Period.of(-1, -2, 0)
- Parameters:
s- period string- Returns:
- the period
- Throws:
DateTimeUtils.DateTimeParseException- if the string cannot be parsed- See Also:
-
parsePeriodQuiet
Parses the string argument as a period, which is a unit of time in terms of calendar time (days, weeks, months, years, etc.).Period strings are formatted according to the ISO-8601 duration format as
PnYnMnDandPnW, where the coefficients can be positive or negative. Zero coefficients can be omitted. Optionally, the string can begin with a negative sign.Examples:
"P2Y" -- Period.ofYears(2) "P3M" -- Period.ofMonths(3) "P4W" -- Period.ofWeeks(4) "P5D" -- Period.ofDays(5) "P1Y2M3D" -- Period.of(1, 2, 3) "P1Y2M3W4D" -- Period.of(1, 2, 25) "P-1Y2M" -- Period.of(-1, 2, 0) "-P1Y2M" -- Period.of(-1, -2, 0)
- Parameters:
s- period string- Returns:
- the period, or
nullif the string can not be parsed - See Also:
-
parseDuration
Parses the string argument as a duration, which is a unit of time in terms of clock time (24-hour days, hours, minutes, seconds, and nanoseconds).Duration strings are formatted according to the ISO-8601 duration format as
[-]PnDTnHnMn.nS, where the coefficients can be positive or negative. Zero coefficients can be omitted. Optionally, the string can begin with a negative sign.Examples:
"PT20.345S" -- parses as "20.345 seconds" "PT15M" -- parses as "15 minutes" (where a minute is 60 seconds) "PT10H" -- parses as "10 hours" (where an hour is 3600 seconds) "P2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds) "P2DT3H4M" -- parses as "2 days, 3 hours and 4 minutes" "PT-6H3M" -- parses as "-6 hours and +3 minutes" "-PT6H3M" -- parses as "-6 hours and -3 minutes" "-PT-6H+3M" -- parses as "+6 hours and -3 minutes"- Parameters:
s- duration string- Returns:
- the duration
- Throws:
DateTimeUtils.DateTimeParseException- if the string cannot be parsed- See Also:
-
parseDurationQuiet
@ScriptApi @Nullable public static @Nullable Duration parseDurationQuiet(@Nullable @Nullable String s) Parses the string argument as a duration, which is a unit of time in terms of clock time (24-hour days, hours, minutes, seconds, and nanoseconds).Duration strings are formatted according to the ISO-8601 duration format as
[-]PnDTnHnMn.nS, where the coefficients can be positive or negative. Zero coefficients can be omitted. Optionally, the string can begin with a negative sign.Examples:
"PT20.345S" -- parses as "20.345 seconds" "PT15M" -- parses as "15 minutes" (where a minute is 60 seconds) "PT10H" -- parses as "10 hours" (where an hour is 3600 seconds) "P2D" -- parses as "2 days" (where a day is 24 hours or 86400 seconds) "P2DT3H4M" -- parses as "2 days, 3 hours and 4 minutes" "PT-6H3M" -- parses as "-6 hours and +3 minutes" "-PT6H3M" -- parses as "-6 hours and -3 minutes" "-PT-6H+3M" -- parses as "+6 hours and -3 minutes"- Parameters:
s- duration string- Returns:
- the duration, or
nullif the string can not be parsed - See Also:
-
parseEpochNanos
Parses the string argument as nanoseconds since the Epoch.Date time strings are formatted according to the ISO 8601 date time format
yyyy-MM-ddThh:mm:ss[.SSSSSSSSS] TZand others. Additionally, date time strings can be integer values that are nanoseconds, milliseconds, or seconds from the Epoch. Expected date ranges are used to infer the units.- Parameters:
s- date time string- Returns:
- a long number of nanoseconds since the Epoch, matching the instant represented by the input string
- Throws:
DateTimeUtils.DateTimeParseException- if the string cannot be parsed- See Also:
-
parseEpochNanosQuiet
Parses the string argument as a nanoseconds since the Epoch.Date time strings are formatted according to the ISO 8601 date time format
yyyy-MM-ddThh:mm:ss[.SSSSSSSSS] TZand others. Additionally, date time strings can be integer values that are nanoseconds, milliseconds, or seconds from the Epoch. Expected date ranges are used to infer the units.- Parameters:
s- date time string- Returns:
- a long number of nanoseconds since the Epoch, matching the instant represented by the input string, or
nullif the string can not be parsed - See Also:
-
parseInstant
Parses the string argument as anInstant.Date time strings are formatted according to the ISO 8601 date time format
yyyy-MM-ddThh:mm:ss[.SSSSSSSSS] TZand others. Additionally, date time strings can be integer values that are nanoseconds, milliseconds, or seconds from the Epoch. Expected date ranges are used to infer the units.- Parameters:
s- date time string- Returns:
- an
Instantrepresented by the input string - Throws:
DateTimeUtils.DateTimeParseException- if the string cannot be parsed- See Also:
-
parseInstantQuiet
@ScriptApi @Nullable public static @Nullable Instant parseInstantQuiet(@Nullable @Nullable String s) Parses the string argument as anInstant.Date time strings are formatted according to the ISO 8601 date time format
yyyy-MM-ddThh:mm:ss[.SSSSSSSSS] TZand others. Additionally, date time strings can be integer values that are nanoseconds, milliseconds, or seconds from the Epoch. Expected date ranges are used to infer the units.- Parameters:
s- date time string- Returns:
- an
Instantrepresented by the input string, ornullif the string can not be parsed - See Also:
-
parseZonedDateTime
@ScriptApi @NotNull public static @NotNull ZonedDateTime parseZonedDateTime(@NotNull @NotNull String s) Parses the string argument as aZonedDateTime.Date time strings are formatted according to the ISO 8601 date time format
yyyy-MM-ddThh:mm:ss[.SSSSSSSSS] TZand others.- Parameters:
s- date time string- Returns:
- a
ZonedDateTimerepresented by the input string - Throws:
DateTimeUtils.DateTimeParseException- if the string cannot be parsed- See Also:
-
parseZonedDateTimeQuiet
@ScriptApi @Nullable public static @Nullable ZonedDateTime parseZonedDateTimeQuiet(@Nullable @Nullable String s) Parses the string argument as aZonedDateTime.Date time strings are formatted according to the ISO 8601 date time format
yyyy-MM-ddThh:mm:ss[.SSSSSSSSS] TZand others.- Parameters:
s- date time string- Returns:
- a
ZonedDateTimerepresented by the input string, ornullif the string can not be parsed - See Also:
-
parseTimePrecision
@ScriptApi @NotNull public static @NotNull ChronoField parseTimePrecision(@NotNull @NotNull String s) Returns aChronoFieldindicating the level of precision in a time, datetime, or period nanos string.- Parameters:
s- time string- Returns:
ChronoFieldfor the finest units in the string (e.g. "10:00:00" would yield SecondOfMinute)- Throws:
RuntimeException- if the string cannot be parsed
-
parseTimePrecisionQuiet
@ScriptApi @Nullable public static @Nullable ChronoField parseTimePrecisionQuiet(@Nullable @Nullable String s) Returns aChronoFieldindicating the level of precision in a time or datetime string.- Parameters:
s- time string- Returns:
nullif the time string cannot be parsed; otherwise, aChronoFieldfor the finest units in the string (e.g. "10:00:00" would yield SecondOfMinute)- Throws:
RuntimeException- if the string cannot be parsed
-
parseLocalDate
Parses the string argument as a local date, which is a date without a time or time zone.Date strings are formatted according to the ISO 8601 date time format as
YYYY-MM-DD.- Parameters:
s- date string- Returns:
- local date parsed according to the default date style
- Throws:
DateTimeUtils.DateTimeParseException- if the string cannot be parsed- See Also:
-
parseLocalDateQuiet
@ScriptApi @Nullable public static @Nullable LocalDate parseLocalDateQuiet(@Nullable @Nullable String s) Parses the string argument as a local date, which is a date without a time or time zone.Date strings are formatted according to the ISO 8601 date time format as
YYYY-MM-DD.- Parameters:
s- date string- Returns:
- local date parsed according to the default date style, or
nullif the string can not be parsed - See Also:
-
parseLocalTime
Parses the string argument as a local time, which is the time that would be read from a clock and does not have a date or timezone.Local time strings can be formatted as
hh:mm:ss[.nnnnnnnnn].- Parameters:
s- string to be converted- Returns:
- a
LocalTimerepresented by the input string. - Throws:
DateTimeUtils.DateTimeParseException- if the string cannot be converted, otherwise aLocalTimefrom the parsed string
-
parseLocalTimeQuiet
@ScriptApi @Nullable public static @Nullable LocalTime parseLocalTimeQuiet(@Nullable @Nullable String s) Parses the string argument as a local time, which is the time that would be read from a clock and does not have a date or timezone.Local time strings can be formatted as
hh:mm:ss[.nnnnnnnnn].- Parameters:
s- string to be converted- Returns:
- a
LocalTimerepresented by the input string, ornullif the string can not be parsed
-
hourOfDay(Instant, ZoneId, boolean)instead.