Class DateTimeExtensions
- 
Method SummaryModifier and TypeMethodDescriptionstatic LocalDateTimeclearTime(LocalDateTime self) Returns aLocalDateTimewith the time portion cleared.static OffsetDateTimeclearTime(OffsetDateTime self) Returns anOffsetDateTimewith the time portion cleared.static ZonedDateTimeclearTime(ZonedDateTime self) Returns anZonedDateTimewith the time portion cleared.static DurationSupports the division operator; equivalent to calling theDuration.dividedBy(long)method.static voidIterates from this to thetoTemporal, inclusive, decrementing by one unit each iteration, calling the closure once per iteration.static voiddownto(Temporal from, Temporal to, TemporalUnit unit, Closure closure) Iterates from this to thetoTemporal, inclusive, decrementing by oneuniteach iteration, calling the closure once per iteration.static StringFormats this date with the providedDateTimeFormatterpattern.static Stringformat(LocalDate self, FormatStyle dateStyle) Formats this date in the provided, localizedFormatStyle.static Stringformat(LocalDateTime self, String pattern) Formats this date/time with the providedDateTimeFormatterpattern.static Stringformat(LocalDateTime self, FormatStyle dateTimeStyle) Formats this date/time in the provided, localizedFormatStyle.static StringFormats this time with the providedDateTimeFormatterpattern.static Stringformat(LocalTime self, FormatStyle timeStyle) Formats this time in the provided, localizedFormatStyle.static Stringformat(OffsetDateTime self, String pattern) Formats this date/time with the providedDateTimeFormatterpattern.static Stringformat(OffsetDateTime self, FormatStyle dateTimeStyle) Formats this date/time in the provided, localizedFormatStyle.static Stringformat(OffsetTime self, String pattern) Formats this time with the providedDateTimeFormatterpattern.static Stringformat(OffsetTime self, FormatStyle timeStyle) Formats this time in the provided, localizedFormatStyle.static Stringformat(ZonedDateTime self, String pattern) Formats this date/time with the providedDateTimeFormatterpattern.static Stringformat(ZonedDateTime self, FormatStyle dateTimeStyle) Formats this date/time in the provided, localizedFormatStyle.getAt(TemporalAccessor self, Iterable<TemporalField> fields) Supports the getAt operator for an iterable; equivalent to collecting theTemporalAccessor.getLong(java.time.temporal.TemporalField)method for each field in the supplied iterable.static longgetAt(TemporalAccessor self, TemporalField field) Supports the getAt operator; equivalent to calling theTemporalAccessor.getLong(java.time.temporal.TemporalField)method.static longgetAt(TemporalAmount self, TemporalUnit unit) Supports the getAt operator; equivalent to calling theTemporalAmount.get(TemporalUnit)method.static longgetAt(ZoneOffset self, TemporalField field) Supports the getAt operator; equivalent to calling theZoneOffset.getLong(java.time.temporal.TemporalField)method.static StringgetDateString(LocalDate self) Formats this date with theDateTimeFormatter.ISO_LOCAL_DATEformatter.static StringgetDateString(LocalDateTime self) Formats this date/time with theDateTimeFormatter.ISO_LOCAL_DATEformatter.static StringgetDateString(OffsetDateTime self) Formats this date/time with theDateTimeFormatter.ISO_OFFSET_DATEformatter.static StringgetDateString(ZonedDateTime self) Formats this date/time with theDateTimeFormatter.ISO_LOCAL_DATEformatter and appends the zone's short name, e.g.static StringFormats this date/time with theDateTimeFormatter.ISO_LOCAL_DATE_TIMEformatter.static StringFormats this date/time with theDateTimeFormatter.ISO_OFFSET_DATE_TIMEformatter.static StringFormats this date/time with theDateTimeFormatter.ISO_LOCAL_DATE_TIMEformatter and appends the zone's short name, e.g.static intEquivalent to calling theYear.get(java.time.temporal.TemporalField)method with aChronoField.ERAargument.static StringgetFullName(ZoneId self) Returns the name of this zone formatted according to theTextStyle.FULLtext style.static StringgetFullName(ZoneId self, Locale locale) Returns the name of this zone formatted according to theTextStyle.FULLtext style for the providedLocale.static intgetHours(ZoneOffset self) Returns the hours component of this offset.static intgetMinutes(ZoneOffset self) Returns the minutes component of this offset.static ZoneOffsetReturns aZoneOffsetfor this zone as of now.static ZoneOffsetReturns aZoneOffsetfor this zone as of the providedInstant.static intgetSeconds(ZoneOffset self) Returns the seconds component of this offset.static StringgetShortName(ZoneId self) Returns the name of this zone formatted according to theTextStyle.SHORTtext style.static StringgetShortName(ZoneId self, Locale locale) Returns the name of this zone formatted according to theTextStyle.SHORTtext style for the providedLocale.static StringgetTimeString(LocalDateTime self) Formats this date/time with theDateTimeFormatter.ISO_LOCAL_TIMEformatter.static StringgetTimeString(LocalTime self) Formats this time with theDateTimeFormatter.ISO_LOCAL_TIMEformatter.static StringgetTimeString(OffsetDateTime self) Formats this date/time with theDateTimeFormatter.ISO_OFFSET_TIMEformatter.static StringgetTimeString(OffsetTime self) Formats this time with theDateTimeFormatter.ISO_OFFSET_TIMEformatter.static StringgetTimeString(ZonedDateTime self) Formats this date/time with theDateTimeFormatter.ISO_LOCAL_TIMEformatter and appends the zone's short name, e.g.static intgetYearOfEra(Year self) Equivalent to calling theYear.get(java.time.temporal.TemporalField)method with aChronoField.YEAR_OF_ERAargument.static ZoneIdReturns the Time Zone of the Calendar as a java.time.ZoneId.static ZoneIdReturns the Time Zone of the Date as aZoneId.static ZoneOffsetgetZoneOffset(Calendar self) Returns the Time Zone offset of the Calendar as aZoneOffset.static ZoneOffsetgetZoneOffset(Date self) Returns the Time Zone offset of the Date as aZoneOffset, which will typically be system's default offset.static booleanisNonnegative(ChronoPeriod self) Returns true if this period is zero or positive.static booleanisNonnegative(Duration self) Returns true if this duration is zero or positive.static booleanisNonpositive(ChronoPeriod self) Returns true if this period is zero or negative.static booleanisNonpositive(Duration self) Returns true if this duration is zero or negative.static booleanisPositive(ChronoPeriod self) Returns true if this period is positive, excluding zero.static booleanisPositive(Duration self) Returns true if this duration is positive, excluding zero.static booleanReturnstrueif the DayOfWeek is a weekday.static booleanReturnstrueif this day of the week is a weekend day (Saturday or Sunday).static LocalDateTimeReturns aLocalDateTimefrom this date and the providedLocalTime.static OffsetDateTimeleftShift(LocalDate self, OffsetTime time) Returns aOffsetDateTimefrom this date and the providedOffsetTime.static ZonedDateTimeleftShift(LocalDateTime self, ZoneId zone) Returns aOffsetDateTimeof this date/time and the providedZoneId.static OffsetDateTimeleftShift(LocalDateTime self, ZoneOffset offset) Returns anOffsetDateTimeof this date/time and the providedZoneOffset.static LocalDateTimeReturns aLocalDateTimeof this time and the providedLocalDate.static OffsetTimeleftShift(LocalTime self, ZoneOffset offset) Returns anOffsetTimeof this time and the providedZoneOffset.static LocalDateReturns aLocalDateof this month/day and the provided year.static LocalDatestatic MonthDayCreates aMonthDayat the provided day of the month.static YearMonthstatic OffsetDateTimeleftShift(OffsetTime self, LocalDate date) Returns anOffsetDateTimeof this time and the providedLocalDate.static LocalDateReturns aLocalDateof this year/month and the given day of the month.static YearMonthstatic LocalDatestatic ZonedDateTimeleftShift(ZoneId self, LocalDateTime dateTime) Returns aZonedDateTimeof this zone and the givenLocalDateTime.static OffsetDateTimeleftShift(ZoneOffset self, LocalDateTime dateTime) Returns anOffsetDateTimeof this offset and the providedLocalDateTime.static OffsetTimeleftShift(ZoneOffset self, LocalTime time) Returns anOffsetDateTimeof this offset and the providedLocalTime.static DayOfWeekReturns theDayOfWeekthat isdaysmany days before this day of the week.static DurationReturns aDurationthat issecondsseconds shorter that this duration.static InstantReturns anInstantthat issecondsseconds before this instant.static LocalDateReturns aLocalDatethat isdaysdays before this date.static longCalculates the number of days between two datesstatic LocalDateTimeminus(LocalDateTime self, long seconds) Returns aLocalDateTimethat issecondsseconds before this date/time.static LocalTimeReturns aLocalTimethat issecondsseconds before this time.static MonthReturns theMonththat ismonthsmonths before this month.static OffsetDateTimeminus(OffsetDateTime self, long seconds) Returns anOffsetDateTimethat issecondsseconds before this date/time.static OffsetTimeminus(OffsetTime self, long seconds) Returns anOffsetTimethat issecondsseconds before this time.static PeriodReturns aPeriodthat isdaysdays shorter than this period.static YearMonthReturns aYearMonththat ismonthsmonths before this year/month.static YearReturns aYearthat isyearsyears before this year.static ZonedDateTimeminus(ZonedDateTime self, long seconds) Returns aZonedDateTimethat issecondsseconds before this date/time.static DurationSupports the multiplication operator; equivalent to calling theDuration.multipliedBy(long)method.static PeriodSupports the multiply operator; equivalent to calling thePeriod.multipliedBy(int)method.static DurationSupports the unary minus operator; equivalent to calling theDuration.negated()method.static PeriodSupports the unary minus operator; equivalent to calling thePeriod.negated()method.static DurationReturns aDurationthat is one second longer than this duration.static InstantReturns anInstantthat is one second after this instant.static LocalDateReturns aLocalDateone day after this date.static LocalDateTimenext(LocalDateTime self) Returns aLocalDateTimethat is one second after this date/time.static LocalTimeReturns aLocalTimethat is one second after this time.static OffsetDateTimenext(OffsetDateTime self) Returns anOffsetDateTimeone second after this date/time.static OffsetTimenext(OffsetTime self) Returns anOffsetTimethat is one second after this time.static PeriodReturns aPeriodthat is one day longer than this period.static YearReturns aYearafter this year.static YearMonthReturns aYearMonththat is the month after this year/month.static ZonedDateTimenext(ZonedDateTime self) Returns aZonedDateTimethat is one second after this date/time.static DayOfWeekReturns theDayOfWeekthat isdaysmany days after this day of the week.static DurationReturns aDurationthat issecondsseconds longer than this duration.static InstantReturns anInstantthat issecondsseconds after this instant.static LocalDateReturns aLocalDatethat isdaysdays after this date.static LocalDateTimeplus(LocalDateTime self, long seconds) Returns aLocalDateTimethat issecondsseconds after this date/time.static LocalTimeReturns aLocalTimethat issecondsseconds after this time.static MonthReturns theMonththat ismonthsmonths after this month.static OffsetDateTimeplus(OffsetDateTime self, long seconds) Returns anOffsetDateTimethat issecondsseconds after this date/time.static OffsetTimeplus(OffsetTime self, long seconds) Returns anOffsetTimethat issecondsseconds after this time.static PeriodReturns aPeriodthat isdaysdays longer than this period.static YearMonthReturns aYearMonththat ismonthsmonths after this year/month.static YearReturns aYearthat isyearsyears after this year.static ZonedDateTimeplus(ZonedDateTime self, long seconds) Returns aZonedDateTimethat issecondsseconds after this date/time.static DurationSupports the unary plus operator; equivalent to calling theDuration.abs()method.static PeriodSupports the unary plus operator; returns aPeriodwith all unit values positive.static DurationReturns aDurationthat is one second shorter than this duration.static InstantReturns anInstantthat one second before this instant.static LocalDateReturns aLocalDateone day before this date.static LocalDateTimeprevious(LocalDateTime self) Returns aLocalDateTimethat is one second before this date/time.static LocalTimeReturns aLocalTimethat is one second before this time.static OffsetDateTimeprevious(OffsetDateTime self) Returns anOffsetDateTimeone second before this date/time.static OffsetTimeprevious(OffsetTime self) Returns anOffsetTimethat is one second before this time.static PeriodReturns aPeriodthat is one day shorter than this period.static YearReturns aYearbefore this year.static YearMonthReturns aYearMonththat is the month before this year/month.static ZonedDateTimeprevious(ZonedDateTime self) Returns aZonedDateTimethat is one second before this date/time.static PeriodrightShift(LocalDate self, LocalDate other) static TemporalAmountrightShift(Temporal self, Temporal other) static PeriodrightShift(YearMonth self, YearMonth other) static PeriodrightShift(Year self, Year year) static CalendartoCalendar(Instant self) Returns a generally equivalentCalendarin the GMT time zone, truncated to milliseconds.static CalendartoCalendar(LocalDate self) Returns an equivalent instance ofCalendar.static CalendartoCalendar(LocalDateTime self) Returns a generally equivalent instance ofCalendar.static CalendartoCalendar(LocalTime self) Returns a generally equivalent instance ofCalendar.static CalendartoCalendar(OffsetDateTime self) Returns a generally equivalent instance ofCalendar.static CalendartoCalendar(OffsetTime self) Returns a generally equivalent instance ofCalendar.static CalendartoCalendar(ZonedDateTime self) Returns a generally equivalent instance ofCalendar.static DateReturns a generally equivalentDateaccording the number of milliseconds since the epoch, adjusted into the system default time zone.static DateReturns an equivalent instance ofDate.static DatetoDate(LocalDateTime self) Returns a generally equivalent instance ofDate.static DateReturns a generally equivalent instance ofDate.static DatetoDate(OffsetDateTime self) Returns a generally equivalent instance ofDate.static DatetoDate(OffsetTime self) Returns a generally equivalent instance ofDate.static DatetoDate(ZonedDateTime self) Returns a generally equivalent instance ofDate.static DayOfWeektoDayOfWeek(Calendar self) Converts the Calendar to a correspondingDayOfWeek.static DayOfWeektoDayOfWeek(Date self) Converts the Date to a correspondingDayOfWeek.static InstantConvenience method for converting a Calendar to a correspondingInstant.static LocalDatetoLocalDate(Date self) Converts the Date to a correspondingLocalDate.static LocalDateTimetoLocalDateTime(Calendar self) Converts the Calendar to a correspondingLocalDateTime.static LocalDateTimetoLocalDateTime(Date self) Converts the Date to a correspondingLocalDateTime.static LocalTimetoLocalTime(Calendar self) Converts the Calendar to a correspondingLocalTime.static LocalTimetoLocalTime(Date self) Converts the Date to a correspondingLocalTime.static MonthConverts the Calendar to a correspondingMonth.static MonthConverts the Date to a correspondingMonth.static MonthDaytoMonthDay(Calendar self) Converts the Calendar to a correspondingMonthDay.static MonthDaytoMonthDay(Date self) Converts the Date to a correspondingMonthDay.static OffsetDateTimetoOffsetDateTime(Calendar self) Converts the Calendar to a correspondingOffsetDateTime.static OffsetDateTimetoOffsetDateTime(Date self) Converts the Date to a correspondingOffsetDateTime.static OffsetTimetoOffsetTime(Calendar self) Converts the Calendar to a correspondingOffsetTime.static OffsetTimetoOffsetTime(Date self) Converts the Date to a correspondingOffsetTime.static TimeZonetoTimeZone(ZoneId self) Returns aTimeZoneequivalent to this zone.static TimeZonetoTimeZone(ZoneOffset self) Returns a generally equivalentTimeZone.static YearConverts the Calendar to a correspondingYear.static YearConverts the Date to a correspondingYear.static YearMonthtoYearMonth(Calendar self) Converts the Calendar to a correspondingYearMonth.static YearMonthtoYearMonth(Date self) Converts the Date to a correspondingYearMonth.static ZonedDateTimetoZonedDateTime(Calendar self) Converts the Calendar to a correspondingZonedDateTime.static ZonedDateTimetoZonedDateTime(Date self) Converts the Date to a correspondingZonedDateTime.static ZoneOffsettoZoneOffset(TimeZone self) Converts the TimeZone to a correspondingZoneOffset.static ZoneOffsettoZoneOffset(TimeZone self, Instant instant) Converts this TimeZone to a correspondingZoneOffset.static voidIterates from this to thetoTemporal, inclusive, incrementing by one unit each iteration, calling the closure once per iteration.static voidupto(Temporal from, Temporal to, TemporalUnit unit, Closure closure) Iterates from this to thetoTemporal, inclusive, incrementing by oneuniteach iteration, calling the closure once per iteration.
- 
Method Details- 
uptoIterates from this to thetoTemporal, inclusive, incrementing by one unit each iteration, calling the closure once per iteration. The closure may accept a singleTemporalargument.The particular unit incremented by depends on the specific subtype of Temporal. Most subtypes use a unit ofChronoUnit.SECONDSexcept for- ChronoLocalDateand its sub-types use- ChronoUnit.DAYS.
- YearMonthuses- ChronoUnit.MONTHS.
- Yearuses- ChronoUnit.YEARS.
 - Parameters:
- from- the starting Temporal
- to- the ending Temporal
- closure- the zero or one-argument closure to call
- Throws:
- GroovyRuntimeException- if this value is later than- to
- GroovyRuntimeException- if- tois a different type than this
- Since:
- 2.5.0
 
- 
uptoIterates from this to thetoTemporal, inclusive, incrementing by oneuniteach iteration, calling the closure once per iteration. The closure may accept a singleTemporalargument.If the unit is too large to iterate to the second Temporal exactly, such as iterating from two LocalDateTimes that are seconds apart using ChronoUnit.DAYSas the unit, the iteration will cease as soon as the current value of the iteration is later than the second Temporal argument. The closure will not be called with any value later than thetovalue.- Parameters:
- from- the starting Temporal
- to- the ending Temporal
- unit- the TemporalUnit to increment by
- closure- the zero or one-argument closure to call
- Throws:
- GroovyRuntimeException- if this value is later than- to
- GroovyRuntimeException- if- tois a different type than this
- Since:
- 2.5.0
 
- 
downtoIterates from this to thetoTemporal, inclusive, decrementing by one unit each iteration, calling the closure once per iteration. The closure may accept a singleTemporalargument.The particular unit decremented by depends on the specific subtype of Temporal. Most subtypes use a unit ofChronoUnit.SECONDSexcept for- ChronoLocalDateand its sub-types use- ChronoUnit.DAYS.
- YearMonthuses- ChronoUnit.MONTHS.
- Yearuses- ChronoUnit.YEARS.
 - Parameters:
- from- the starting Temporal
- to- the ending Temporal
- closure- the zero or one-argument closure to call
- Throws:
- GroovyRuntimeException- if this value is earlier than- to
- GroovyRuntimeException- if- tois a different type than this
- Since:
- 2.5.0
 
- 
downtoIterates from this to thetoTemporal, inclusive, decrementing by oneuniteach iteration, calling the closure once per iteration. The closure may accept a singleTemporalargument.If the unit is too large to iterate to the second Temporal exactly, such as iterating from two LocalDateTimes that are seconds apart using ChronoUnit.DAYSas the unit, the iteration will cease as soon as the current value of the iteration is earlier than the second Temporal argument. The closure will not be called with any value earlier than thetovalue.- Parameters:
- from- the starting Temporal
- to- the ending Temporal
- unit- the TemporalUnit to increment by
- closure- the zero or one-argument closure to call
- Throws:
- GroovyRuntimeException- if this value is earlier than- to
- GroovyRuntimeException- if- tois a different type than this
- Since:
- 2.5.0
 
- 
rightShiftReturns aDurationorPeriodbetween this (inclusive) and theotherTemporal(exclusive).A Period will be returned for types Year,YearMonth, andChronoLocalDate; otherwise, a Duration will be returned.Note: if the Temporal is a ChronoLocalDate but not a LocalDate, a generalChronoPeriodwill be returned as per the return type of the methodChronoLocalDate.until(ChronoLocalDate).- Parameters:
- self- a Temporal
- other- another Temporal of the same type
- Returns:
- an TemporalAmount between the two Temporals
- Since:
- 2.5.0
 
- 
getAtSupports the getAt operator; equivalent to calling theTemporalAccessor.getLong(java.time.temporal.TemporalField)method.- Parameters:
- self- a TemporalAccessor
- field- a non-null TemporalField
- Returns:
- the value for the field
- Throws:
- DateTimeException- if a value for the field cannot be obtained
- UnsupportedTemporalTypeException- if the field is not supported
- ArithmeticException- if numeric overflow occurs
- Since:
- 2.5.0
 
- 
getAtSupports the getAt operator for an iterable; equivalent to collecting theTemporalAccessor.getLong(java.time.temporal.TemporalField)method for each field in the supplied iterable.import static java.time.temporal.ChronoField.* import java.time.LocalTime def breakfast = LocalTime.of(8, 30, 0) def (h, m, s) = breakfast[HOUR_OF_DAY, MINUTE_OF_HOUR, SECOND_OF_MINUTE] assert "$h:$m:$s" == "8:30:0" - Parameters:
- self- a TemporalAccessor
- fields- an iterable of non-null TemporalField values
- Returns:
- the list of values for the fields
- Throws:
- DateTimeException- if a value for the field cannot be obtained
- UnsupportedTemporalTypeException- if the field is not supported
- ArithmeticException- if numeric overflow occurs
- Since:
- 4.0.6
 
- 
getAtSupports the getAt operator; equivalent to calling theTemporalAmount.get(TemporalUnit)method.- Parameters:
- self- a TemporalAmount
- unit- a non-null TemporalUnit
- Returns:
- the value for the field
- Throws:
- DateTimeException- if a value for the field cannot be obtained
- UnsupportedTemporalTypeException- if the field is not supported
- ArithmeticException- if numeric overflow occurs
- Since:
- 2.5.0
 
- 
plusReturns aDurationthat issecondsseconds longer than this duration.- Parameters:
- self- a Duration
- seconds- the number of seconds to add
- Returns:
- a Duration
- Since:
- 2.5.0
 
- 
minusReturns aDurationthat issecondsseconds shorter that this duration.- Parameters:
- self- a Duration
- seconds- the number of seconds to subtract
- Returns:
- a Duration
- Since:
- 2.5.0
 
- 
nextReturns aDurationthat is one second longer than this duration.- Parameters:
- self- a Duration
- Returns:
- a Duration
- Since:
- 2.5.0
 
- 
previousReturns aDurationthat is one second shorter than this duration.- Parameters:
- self- a Duration
- Returns:
- a Duration
- Since:
- 2.5.0
 
- 
negativeSupports the unary minus operator; equivalent to calling theDuration.negated()method.- Parameters:
- self- a Duration
- Returns:
- a Duration
- Since:
- 2.5.0
 
- 
positiveSupports the unary plus operator; equivalent to calling theDuration.abs()method.- Parameters:
- self- a Duration
- Returns:
- a Duration
- Since:
- 2.5.0
 
- 
multiplySupports the multiplication operator; equivalent to calling theDuration.multipliedBy(long)method.- Parameters:
- self- a Duration
- scalar- the value to multiply by
- Returns:
- a Duration
- Since:
- 2.5.0
 
- 
divSupports the division operator; equivalent to calling theDuration.dividedBy(long)method.- Parameters:
- self- a Duration
- scalar- the value to divide by
- Returns:
- a Duration
- Since:
- 2.5.0
 
- 
isPositiveReturns true if this duration is positive, excluding zero.- Parameters:
- self- a Duration
- Returns:
- true if positive
- Since:
- 2.5.0
 
- 
isNonnegativeReturns true if this duration is zero or positive.- Parameters:
- self- a Duration
- Returns:
- true if nonnegative
- Since:
- 2.5.0
 
- 
isNonpositiveReturns true if this duration is zero or negative.- Parameters:
- self- a Duration
- Returns:
- true if nonpositive
- Since:
- 2.5.0
 
- 
plusReturns anInstantthat issecondsseconds after this instant.- Parameters:
- self- an Instant
- seconds- the number of seconds to add
- Returns:
- an Instant
- Since:
- 2.5.0
 
- 
minusReturns anInstantthat issecondsseconds before this instant.- Parameters:
- self- an Instant
- seconds- the number of seconds to subtract
- Returns:
- an Instant
- Since:
- 2.5.0
 
- 
nextReturns anInstantthat is one second after this instant.- Parameters:
- self- an Instant
- Returns:
- an Instant one-second ahead
- Since:
- 2.5.0
 
- 
previousReturns anInstantthat one second before this instant.- Parameters:
- self- an Instant
- Returns:
- an Instant one-second behind
- Since:
- 2.5.0
 
- 
toDateReturns a generally equivalentDateaccording the number of milliseconds since the epoch, adjusted into the system default time zone.- Parameters:
- self- an Instant
- Returns:
- a Date
- Since:
- 2.5.0
 
- 
toCalendarReturns a generally equivalentCalendarin the GMT time zone, truncated to milliseconds.- Parameters:
- self- an Instant
- Returns:
- a Calendar
- Since:
- 2.5.0
 
- 
formatFormats this date with the providedDateTimeFormatterpattern.- Parameters:
- self- a LocalDate
- pattern- the formatting pattern
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
formatFormats this date in the provided, localizedFormatStyle.- Parameters:
- self- a LocalDate
- dateStyle- the FormatStyle
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getDateStringFormats this date with theDateTimeFormatter.ISO_LOCAL_DATEformatter.- Parameters:
- self- a LocalDate
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
plusReturns aLocalDatethat isdaysdays after this date.- Parameters:
- self- a LocalDate
- days- the number of days to add
- Returns:
- a LocalDate
- Since:
- 2.5.0
 
- 
minusReturns aLocalDatethat isdaysdays before this date.- Parameters:
- self- a LocalDate
- days- the number of days to subtract
- Returns:
- a LocalDate
- Since:
- 2.5.0
 
- 
minusCalculates the number of days between two dates- Parameters:
- self- a LocalDate
- other- the other LocalDate
- Returns:
- the number of days
- Since:
- 3.0.0
 
- 
nextReturns aLocalDateone day after this date.- Parameters:
- self- a LocalDate
- Returns:
- the next day
- Since:
- 2.5.0
 
- 
previousReturns aLocalDateone day before this date.- Parameters:
- self- a LocalDate
- Returns:
- the previous day
- Since:
- 2.5.0
 
- 
rightShiftReturns aPeriodequivalent to the time between this date (inclusive) and the providedLocalDate(exclusive).- Parameters:
- self- a LocalDate
- other- another LocalDate
- Returns:
- a Period representing the time between the two LocalDates
- Since:
- 2.5.0
 
- 
leftShiftReturns aLocalDateTimefrom this date and the providedLocalTime.- Parameters:
- self- a LocalDate
- time- a LocalTime
- Returns:
- a LocalDateTime
- Since:
- 2.5.0
 
- 
leftShiftReturns aOffsetDateTimefrom this date and the providedOffsetTime.- Parameters:
- self- a LocalDate
- time- an OffsetTime
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
toDateReturns an equivalent instance ofDate. The time portion of the returned date is cleared.- Parameters:
- self- a LocalDate
- Returns:
- a java.util.Date
- Since:
- 2.5.0
 
- 
toCalendarReturns an equivalent instance ofCalendar. The time portion of the returned calendar is cleared and the time zone is the current system default.- Parameters:
- self- a LocalDate
- Returns:
- a java.util.Calendar
- Since:
- 2.5.0
 
- 
formatFormats this date/time with the providedDateTimeFormatterpattern.- Parameters:
- self- a LocalDateTime
- pattern- the formatting pattern
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
formatFormats this date/time in the provided, localizedFormatStyle.- Parameters:
- self- a LocalDateTime
- dateTimeStyle- the FormatStyle
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getDateTimeStringFormats this date/time with theDateTimeFormatter.ISO_LOCAL_DATE_TIMEformatter.- Parameters:
- self- a LocalDateTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getDateStringFormats this date/time with theDateTimeFormatter.ISO_LOCAL_DATEformatter.- Parameters:
- self- a LocalDateTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getTimeStringFormats this date/time with theDateTimeFormatter.ISO_LOCAL_TIMEformatter.- Parameters:
- self- a LocalDateTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
clearTimeReturns aLocalDateTimewith the time portion cleared.- Parameters:
- self- a LocalDateTime
- Returns:
- a LocalDateTime
- Since:
- 2.5.0
 
- 
plusReturns aLocalDateTimethat issecondsseconds after this date/time.- Parameters:
- self- a LocalDateTime
- seconds- the number of seconds to add
- Returns:
- a LocalDateTime
- Since:
- 2.5.0
 
- 
minusReturns aLocalDateTimethat issecondsseconds before this date/time.- Parameters:
- self- a LocalDateTime
- seconds- the number of seconds to subtract
- Returns:
- a LocalDateTime
- Since:
- 2.5.0
 
- 
nextReturns aLocalDateTimethat is one second after this date/time.- Parameters:
- self- a LocalDateTime
- Returns:
- a LocalDateTime
- Since:
- 2.5.0
 
- 
previousReturns aLocalDateTimethat is one second before this date/time.- Parameters:
- self- a LocalDateTime
- Returns:
- a LocalDateTime
- Since:
- 2.5.0
 
- 
leftShiftReturns anOffsetDateTimeof this date/time and the providedZoneOffset.- Parameters:
- self- a LocalDateTime
- offset- a ZoneOffset
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
leftShiftReturns aOffsetDateTimeof this date/time and the providedZoneId.- Parameters:
- self- a LocalDateTime
- zone- a ZoneId
- Returns:
- a ZonedDateTime
- Since:
- 2.5.0
 
- 
toDateReturns a generally equivalent instance ofDate. The time value of the returned date is truncated to milliseconds.- Parameters:
- self- a LocalDateTime
- Returns:
- a java.util.Date
- Since:
- 2.5.0
 
- 
toCalendarReturns a generally equivalent instance ofCalendar. The time value of the returned calendar is truncated to milliseconds and the time zone is the current system default.- Parameters:
- self- a LocalDateTime
- Returns:
- a java.util.Calendar
- Since:
- 2.5.0
 
- 
formatFormats this time with the providedDateTimeFormatterpattern.- Parameters:
- self- a LocalDateTime
- pattern- the formatting pattern
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
formatFormats this time in the provided, localizedFormatStyle.- Parameters:
- self- a LocalTime
- timeStyle- the FormatStyle
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getTimeStringFormats this time with theDateTimeFormatter.ISO_LOCAL_TIMEformatter.- Parameters:
- self- a LocalTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
plusReturns aLocalTimethat issecondsseconds after this time.- Parameters:
- self- a LocalTime
- seconds- the number of seconds to add
- Returns:
- a LocalTime
- Since:
- 2.5.0
 
- 
minusReturns aLocalTimethat issecondsseconds before this time.- Parameters:
- self- a LocalTime
- seconds- the number of seconds to subtract
- Returns:
- a LocalTime
- Since:
- 2.5.0
 
- 
nextReturns aLocalTimethat is one second after this time.- Parameters:
- self- a LocalTime
- Returns:
- a LocalTime
- Since:
- 2.5.0
 
- 
previousReturns aLocalTimethat is one second before this time.- Parameters:
- self- a LocalTime
- Returns:
- a LocalTime
- Since:
- 2.5.0
 
- 
leftShiftReturns aLocalDateTimeof this time and the providedLocalDate.- Parameters:
- self- a LocalTime
- date- a LocalDate
- Returns:
- a LocalDateTime
- Since:
- 2.5.0
 
- 
leftShiftReturns anOffsetTimeof this time and the providedZoneOffset.- Parameters:
- self- a LocalTime
- offset- a ZoneOffset
- Returns:
- an OffsetTime
- Since:
- 2.5.0
 
- 
toDateReturns a generally equivalent instance ofDate. The day-month-year value of the returned date is today and the time is truncated to milliseconds.- Parameters:
- self- a LocalTime
- Returns:
- a java.util.Date
- Since:
- 2.5.0
 
- 
toCalendarReturns a generally equivalent instance ofCalendar. The day-month-year value of the returned calendar is today, the time is truncated to milliseconds, and the time zone is the current system default.- Parameters:
- self- a LocalTime
- Returns:
- a java.util.Calendar
- Since:
- 2.5.0
 
- 
leftShiftReturns aLocalDateof this month/day and the provided year.- Parameters:
- self- a MonthDay
- year- a year
- Returns:
- a LocalDate
- Since:
- 2.5.0
 
- 
leftShift- Parameters:
- self- a MonthDay
- year- a Year
- Returns:
- a LocalDate
- Since:
- 2.5.0
 
- 
formatFormats this date/time with the providedDateTimeFormatterpattern.- Parameters:
- self- an OffsetDateTime
- pattern- the formatting pattern
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
formatFormats this date/time in the provided, localizedFormatStyle.- Parameters:
- self- an OffsetDateTime
- dateTimeStyle- the FormatStyle
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getDateTimeStringFormats this date/time with theDateTimeFormatter.ISO_OFFSET_DATE_TIMEformatter.- Parameters:
- self- an OffsetDateTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getDateStringFormats this date/time with theDateTimeFormatter.ISO_OFFSET_DATEformatter.- Parameters:
- self- an OffsetDateTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getTimeStringFormats this date/time with theDateTimeFormatter.ISO_OFFSET_TIMEformatter.- Parameters:
- self- an OffsetDateTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
clearTimeReturns anOffsetDateTimewith the time portion cleared.- Parameters:
- self- an OffsetDateTime
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
plusReturns anOffsetDateTimethat issecondsseconds after this date/time.- Parameters:
- self- an OffsetDateTime
- seconds- the number of seconds to add
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
minusReturns anOffsetDateTimethat issecondsseconds before this date/time.- Parameters:
- self- an OffsetDateTime
- seconds- the number of seconds to subtract
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
nextReturns anOffsetDateTimeone second after this date/time.- Parameters:
- self- an OffsetDateTime
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
previousReturns anOffsetDateTimeone second before this date/time.- Parameters:
- self- an OffsetDateTime
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
toDateReturns a generally equivalent instance ofDate. The time value of the returned date is truncated to milliseconds and will be adjusted to the current system default time zone.- Parameters:
- self- an OffsetDateTime
- Returns:
- a java.util.Date
- Since:
- 2.5.0
 
- 
toCalendarReturns a generally equivalent instance ofCalendar. The time value of the returned calendar is truncated to milliseconds and the time zone is based on the offset of this date/time.- Parameters:
- self- an OffsetDateTime
- Returns:
- a java.util.Calendar
- Since:
- 2.5.0
 
- 
formatFormats this time with the providedDateTimeFormatterpattern.- Parameters:
- self- an OffsetTime
- pattern- the formatting pattern
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
formatFormats this time in the provided, localizedFormatStyle.- Parameters:
- self- an OffsetTime
- timeStyle- the FormatStyle
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getTimeStringFormats this time with theDateTimeFormatter.ISO_OFFSET_TIMEformatter.- Parameters:
- self- an OffsetTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
plusReturns anOffsetTimethat issecondsseconds after this time.- Parameters:
- self- an OffsetTime
- seconds- the number of seconds to add
- Returns:
- an OffsetTime
- Since:
- 2.5.0
 
- 
minusReturns anOffsetTimethat issecondsseconds before this time.- Parameters:
- self- an OffsetTime
- seconds- the number of seconds to subtract
- Returns:
- an OffsetTime
- Since:
- 2.5.0
 
- 
nextReturns anOffsetTimethat is one second after this time.- Parameters:
- self- an OffsetTime
- Returns:
- an OffsetTime
- Since:
- 2.5.0
 
- 
previousReturns anOffsetTimethat is one second before this time.- Parameters:
- self- an OffsetTime
- Returns:
- an OffsetTime
- Since:
- 2.5.0
 
- 
leftShiftReturns anOffsetDateTimeof this time and the providedLocalDate.- Parameters:
- self- an OffsetTime
- date- a LocalDate
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
toDateReturns a generally equivalent instance ofDate. The time value of the returned date is truncated to milliseconds and will be adjusted to the current system default time zone.- Parameters:
- self- an OffsetTime
- Returns:
- a java.util.Date
- Since:
- 2.5.0
 
- 
toCalendarReturns a generally equivalent instance ofCalendar. The date value of the returned calendar is now, the time value is truncated to milliseconds, and the time zone is based on the offset of this time.- Parameters:
- self- an OffsetTime
- Returns:
- a java.util.Calendar
- Since:
- 2.5.0
 
- 
plusReturns aPeriodthat isdaysdays longer than this period. No normalization is performed.- Parameters:
- self- a Period
- days- the number of days to increase this Period by
- Returns:
- a Period
- Since:
- 2.5.0
 
- 
minusReturns aPeriodthat isdaysdays shorter than this period. No normalization is performed.- Parameters:
- self- a Period
- days- the number of days to decrease this Period by
- Returns:
- a Period
- Since:
- 2.5.0
 
- 
nextReturns aPeriodthat is one day longer than this period. No normalization is performed.- Parameters:
- self- a Period
- Returns:
- a Period one-day longer in length
- Since:
- 2.5.0
 
- 
previousReturns aPeriodthat is one day shorter than this period. No normalization is performed.- Parameters:
- self- a Period
- Returns:
- a Period one-day shorter in length
- Since:
- 2.5.0
 
- 
negativeSupports the unary minus operator; equivalent to calling thePeriod.negated()method.- Parameters:
- self- a Period
- Returns:
- a negated Period
- Since:
- 2.5.0
 
- 
positiveSupports the unary plus operator; returns aPeriodwith all unit values positive. For example, a period of "2 years, -3 months, and -4 days" would result in a period of "2 years, 3 months, and 4 days." No normalization is performed.- Parameters:
- self- a Period
- Returns:
- a positive Period
- Since:
- 2.5.0
 
- 
multiplySupports the multiply operator; equivalent to calling thePeriod.multipliedBy(int)method.- Parameters:
- self- a Period
- scalar- a scalar to multiply each unit by
- Returns:
- a Period
- Since:
- 2.5.0
 
- 
isPositiveReturns true if this period is positive, excluding zero.- Parameters:
- self- a ChronoPeriod
- Returns:
- true if positive
- Since:
- 2.5.0
 
- 
isNonnegativeReturns true if this period is zero or positive.- Parameters:
- self- a ChronoPeriod
- Returns:
- true if nonnegative
- Since:
- 2.5.0
 
- 
isNonpositiveReturns true if this period is zero or negative.- Parameters:
- self- a ChronoPeriod
- Returns:
- true if nonpositive
- Since:
- 2.5.0
 
- 
plusReturns aYearthat isyearsyears after this year.- Parameters:
- self- a Year
- years- the number of years to add
- Returns:
- a Year
- Since:
- 2.5.0
 
- 
minusReturns aYearthat isyearsyears before this year.- Parameters:
- self- a Year
- years- the number of years to subtract
- Returns:
- a Year
- Since:
- 2.5.0
 
- 
nextReturns aYearafter this year.- Parameters:
- self- a Year
- Returns:
- the next Year
- Since:
- 2.5.0
 
- 
previousReturns aYearbefore this year.- Parameters:
- self- a Year
- Returns:
- the previous Year
- Since:
- 2.5.0
 
- 
rightShiftReturns aPeriodbetween the first day of this year (inclusive) and the first day of the providedYear(exclusive).- Parameters:
- self- a Year
- year- another Year
- Returns:
- a Period between the Years
- Since:
- 2.5.0
 
- 
leftShift- Parameters:
- self- a Year
- month- a Month
- Returns:
- a YearMonth
- Since:
- 2.5.0
 
- 
leftShift- Parameters:
- self- a Year
- monthDay- a MonthDay
- Returns:
- a LocalDate
- Since:
- 2.5.0
 
- 
getEraEquivalent to calling theYear.get(java.time.temporal.TemporalField)method with aChronoField.ERAargument.Returns the era of the year, which is currently either 0 (BC) or 1 (AD). - Parameters:
- self- a Year
- Returns:
- an int representing the era
- Since:
- 2.5.0
 
- 
getYearOfEraEquivalent to calling theYear.get(java.time.temporal.TemporalField)method with aChronoField.YEAR_OF_ERAargument.Since Year=0 represents 1 BC, the yearOfEra value of Year=0 is 1, Year=-1 is 2, and so on. - Parameters:
- self- a Year
- Returns:
- the year value of the era
- Since:
- 2.5.0
 
- 
plusReturns aYearMonththat ismonthsmonths after this year/month.- Parameters:
- self- a YearMonth
- months- the number of months to add
- Returns:
- a Year
- Since:
- 2.5.0
 
- 
minusReturns aYearMonththat ismonthsmonths before this year/month.- Parameters:
- self- a YearMonth
- months- the number of months to subtract
- Returns:
- a Year
- Since:
- 2.5.0
 
- 
nextReturns aYearMonththat is the month after this year/month.- Parameters:
- self- a YearMonth
- Returns:
- the next YearMonth
- Since:
- 2.5.0
 
- 
previousReturns aYearMonththat is the month before this year/month.- Parameters:
- self- a YearMonth
- Returns:
- the previous YearMonth
- Since:
- 2.5.0
 
- 
leftShiftReturns aLocalDateof this year/month and the given day of the month.- Parameters:
- self- a YearMonth
- dayOfMonth- a day of the month
- Returns:
- a LocalDate
- Since:
- 2.5.0
 
- 
rightShiftReturns aPeriodof time between the first day of this year/month (inclusive) and the givenYearMonth(exclusive).- Parameters:
- self- a YearMonth
- other- another YearMonth
- Returns:
- a Period
- Since:
- 2.5.0
 
- 
formatFormats this date/time with the providedDateTimeFormatterpattern.- Parameters:
- self- a ZonedDateTime
- pattern- the formatting pattern
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
formatFormats this date/time in the provided, localizedFormatStyle.- Parameters:
- self- a ZonedDateTime
- dateTimeStyle- the FormatStyle
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getDateTimeStringFormats this date/time with theDateTimeFormatter.ISO_LOCAL_DATE_TIMEformatter and appends the zone's short name, e.g.2018-03-10T14:34:55.144EST.- Parameters:
- self- a ZonedDateTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getDateStringFormats this date/time with theDateTimeFormatter.ISO_LOCAL_DATEformatter and appends the zone's short name, e.g.2018-03-10EST.- Parameters:
- self- a ZonedDateTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
getTimeStringFormats this date/time with theDateTimeFormatter.ISO_LOCAL_TIMEformatter and appends the zone's short name, e.g.14:34:55.144EST.- Parameters:
- self- a ZonedDateTime
- Returns:
- a formatted String
- Since:
- 2.5.0
- See Also:
 
- 
clearTimeReturns anZonedDateTimewith the time portion cleared.- Parameters:
- self- a ZonedDateTime
- Returns:
- a ZonedDateTime
- Since:
- 2.5.0
 
- 
plusReturns aZonedDateTimethat issecondsseconds after this date/time.- Parameters:
- self- an ZonedDateTime
- seconds- the number of seconds to add
- Returns:
- a ZonedDateTime
- Since:
- 2.5.0
 
- 
minusReturns aZonedDateTimethat issecondsseconds before this date/time.- Parameters:
- self- a ZonedDateTime
- seconds- the number of seconds to subtract
- Returns:
- a ZonedDateTime
- Since:
- 2.5.0
 
- 
nextReturns aZonedDateTimethat is one second after this date/time.- Parameters:
- self- a ZonedDateTime
- Returns:
- a ZonedDateTime
- Since:
- 2.5.0
 
- 
previousReturns aZonedDateTimethat is one second before this date/time.- Parameters:
- self- a ZonedDateTime
- Returns:
- a ZonedDateTime
- Since:
- 2.5.0
 
- 
toDateReturns a generally equivalent instance ofDate. The time value of the returned date is truncated to milliseconds and will be adjusted to the current system default time zone.- Parameters:
- self- a ZonedDateTime
- Returns:
- a java.util.Date
- Since:
- 2.5.0
 
- 
toCalendarReturns a generally equivalent instance ofCalendar. The time value of the returned calendar is truncated to milliseconds and the time zone is determined by the zone of this date/time.- Parameters:
- self- an ZonedDateTime
- Returns:
- a java.util.Calendar
- Since:
- 2.5.0
 
- 
toTimeZoneReturns aTimeZoneequivalent to this zone.- Parameters:
- self- a ZoneId
- Returns:
- a TimeZone
- Since:
- 2.5.0
 
- 
getFullNameReturns the name of this zone formatted according to theTextStyle.FULLtext style.- Parameters:
- self- a ZoneId
- Returns:
- the full display name of the ZoneId
- Since:
- 2.5.0
 
- 
getFullNameReturns the name of this zone formatted according to theTextStyle.FULLtext style for the providedLocale.- Parameters:
- self- a ZoneId
- locale- a Locale
- Returns:
- the full display name of the ZoneId
- Since:
- 2.5.0
 
- 
getShortNameReturns the name of this zone formatted according to theTextStyle.SHORTtext style.- Parameters:
- self- a ZoneId
- Returns:
- the short display name of the ZoneId
- Since:
- 2.5.0
 
- 
getShortNameReturns the name of this zone formatted according to theTextStyle.SHORTtext style for the providedLocale.- Parameters:
- self- a ZoneId
- locale- a Locale
- Returns:
- the short display name of the ZoneId
- Since:
- 2.5.0
 
- 
getOffsetReturns aZoneOffsetfor this zone as of now.- Parameters:
- self- a ZoneId
- Returns:
- a ZoneOffset
- Since:
- 2.5.0
 
- 
getOffsetReturns aZoneOffsetfor this zone as of the providedInstant.- Parameters:
- self- a ZoneId
- instant- an Instant
- Returns:
- a ZoneOffset
- Since:
- 2.5.0
 
- 
leftShiftReturns aZonedDateTimeof this zone and the givenLocalDateTime.- Parameters:
- self- a ZoneId
- Returns:
- a ZonedDateTime
- Since:
- 2.5.0
 
- 
toTimeZoneReturns a generally equivalentTimeZone. The offset will be truncated to minutes.- Parameters:
- self- a ZoneOffset
- Returns:
- a TimeZone
- Since:
- 2.5.0
 
- 
getHoursReturns the hours component of this offset. If the offset's total seconds are negative, a negative value will be returned.- Parameters:
- self- a ZoneOffset
- Returns:
- the hours component value
- Since:
- 2.5.0
 
- 
getMinutesReturns the minutes component of this offset. If the offset's total seconds are negative, a negative value will be returned.- Parameters:
- self- a ZoneOffset
- Returns:
- the minutes component value
- Since:
- 2.5.0
 
- 
getSecondsReturns the seconds component of this offset. This is not the same as the total seconds. For example:def offset = ZoneOffset.ofHoursMinutesSeconds(0, 1, 1) assert offset.seconds == 1 assert offset.totalSeconds == 61If the offset's total seconds are negative, a negative value will be returned. - Parameters:
- self- a ZoneOffset
- Returns:
- the seconds component value
- Since:
- 2.5.0
 
- 
getAtSupports the getAt operator; equivalent to calling theZoneOffset.getLong(java.time.temporal.TemporalField)method.- Parameters:
- self- a ZoneOffset
- field- a TemporalField
- Returns:
- the ZoneOffset's field value
- Since:
- 2.5.0
 
- 
leftShiftReturns anOffsetDateTimeof this offset and the providedLocalDateTime.- Parameters:
- self- a ZoneOffset
- dateTime- a LocalDateTime
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
leftShiftReturns anOffsetDateTimeof this offset and the providedLocalTime.- Parameters:
- self- a ZoneOffset
- time- a LocalTime
- Returns:
- an OffsetTime
- Since:
- 2.5.0
 
- 
plusReturns theDayOfWeekthat isdaysmany days after this day of the week.- Parameters:
- self- a DayOfWeek
- days- the number of days to move forward
- Returns:
- the DayOfWeek
- Since:
- 2.5.0
 
- 
minusReturns theDayOfWeekthat isdaysmany days before this day of the week.- Parameters:
- self- a DayOfWeek
- days- the number of days to move back
- Returns:
- the DayOfWeek
- Since:
- 2.5.0
 
- 
isWeekendReturnstrueif this day of the week is a weekend day (Saturday or Sunday).- Parameters:
- self- a DayOfWeek
- Returns:
- true if this DayOfWeek is Saturday or Sunday
- Since:
- 2.5.0
 
- 
isWeekdayReturnstrueif the DayOfWeek is a weekday.- Returns:
- true if this DayOfWeek is Monday through Friday
- Since:
- 2.5.0
 
- 
plusReturns theMonththat ismonthsmonths after this month.- Parameters:
- self- a Month
- months- the number of months move forward
- Returns:
- the Month
- Since:
- 2.5.0
 
- 
minusReturns theMonththat ismonthsmonths before this month.- Parameters:
- self- a Month
- months- the number of months to move back
- Returns:
- the Month
- Since:
- 2.5.0
 
- 
leftShiftCreates aMonthDayat the provided day of the month.- Parameters:
- self- a Month
- dayOfMonth- a day of the month
- Returns:
- a MonthDay
- Since:
- 2.5.0
 
- 
leftShift- Parameters:
- self- a Month
- year- a Year
- Returns:
- a YearMonth
- Since:
- 2.5.0
 
- 
getZoneOffsetReturns the Time Zone offset of the Calendar as aZoneOffset.- Parameters:
- self- a Calendar
- Returns:
- a ZoneOffset
- Since:
- 2.5.0
 
- 
getZoneOffsetReturns the Time Zone offset of the Date as aZoneOffset, which will typically be system's default offset.- Parameters:
- self- a Date
- Returns:
- a ZoneOffset
- Since:
- 2.5.0
 
- 
getZoneIdReturns the Time Zone of the Calendar as a java.time.ZoneId.- Parameters:
- self- a Calendar
- Returns:
- a ZoneId
- Since:
- 2.5.0
 
- 
getZoneIdReturns the Time Zone of the Date as aZoneId. This will typically be the system's default ZoneId.- Parameters:
- self- a Date
- Returns:
- a ZoneId
- Since:
- 2.5.0
 
- 
toYearConverts the Calendar to a correspondingYear. If the Calendar has a different time zone than the system default, the Year will be adjusted into the default time zone.- Parameters:
- self- a Calendar
- Returns:
- a Year
- Since:
- 2.5.0
 
- 
toYearConverts the Date to a correspondingYear.- Parameters:
- self- a Date
- Returns:
- a Year
- Since:
- 2.5.0
 
- 
toMonthConverts the Calendar to a correspondingMonth. If the Calendar has a different time zone than the system default, the Month will be adjusted into the default time zone.- Parameters:
- self- a Calendar
- Returns:
- a Month
- Since:
- 2.5.0
 
- 
toMonthConverts the Date to a correspondingMonth.- Parameters:
- self- a Date
- Returns:
- a Month
- Since:
- 2.5.0
 
- 
toMonthDayConverts the Calendar to a correspondingMonthDay. If the Calendar has a different time zone than the system default, the MonthDay will be adjusted into the default time zone.- Parameters:
- self- a Calendar
- Returns:
- a MonthDay
- Since:
- 2.5.0
 
- 
toMonthDayConverts the Date to a correspondingMonthDay.- Parameters:
- self- a Date
- Returns:
- a MonthDay
- Since:
- 2.5.0
 
- 
toYearMonthConverts the Calendar to a correspondingYearMonth. If the Calendar has a different time zone than the system default, the YearMonth will be adjusted into the default time zone.- Parameters:
- self- a Calendar
- Returns:
- a YearMonth
- Since:
- 2.5.0
 
- 
toYearMonthConverts the Date to a correspondingYearMonth.- Parameters:
- self- a Date
- Returns:
- a YearMonth
- Since:
- 2.5.0
 
- 
toDayOfWeekConverts the Calendar to a correspondingDayOfWeek. If the Calendar has a different time zone than the system default, the DayOfWeek will be adjusted into the default time zone.- Parameters:
- self- a Calendar
- Returns:
- a DayOfWeek
- Since:
- 2.5.0
 
- 
toDayOfWeekConverts the Date to a correspondingDayOfWeek.- Parameters:
- self- a Date
- Returns:
- a DayOfWeek
- Since:
- 2.5.0
 
- 
toLocalDateConverts the Date to a correspondingLocalDate.- Parameters:
- self- a Date
- Returns:
- a LocalDate
- Since:
- 2.5.0
 
- 
toLocalTimeConverts the Calendar to a correspondingLocalTime. If the Calendar has a different time zone than the system default, the LocalTime will be adjusted into the default time zone.- Parameters:
- self- a Calendar
- Returns:
- a LocalTime
- Since:
- 2.5.0
 
- 
toLocalTimeConverts the Date to a correspondingLocalTime.- Parameters:
- self- a Date
- Returns:
- a LocalTime
- Since:
- 2.5.0
 
- 
toLocalDateTimeConverts the Calendar to a correspondingLocalDateTime. If the Calendar has a different time zone than the system default, the LocalDateTime will be adjusted into the default time zone.- Parameters:
- self- a Calendar
- Returns:
- a LocalDateTime
- Since:
- 2.5.0
 
- 
toLocalDateTimeConverts the Date to a correspondingLocalDateTime.- Parameters:
- self- a Date
- Returns:
- a LocalDateTime
- Since:
- 2.5.0
 
- 
toZonedDateTimeConverts the Calendar to a corresponding ZonedDateTime.Note that GregorianCalendarhas aGregorianCalendar.toZonedDateTime()method, which is commonly the specific type of Calendar in use.- Parameters:
- self- a Calendar
- Returns:
- a ZonedDateTime
- Since:
- 2.5.0
 
- 
toZonedDateTimeConverts the Date to a correspondingZonedDateTime.- Parameters:
- self- a Date
- Returns:
- a ZonedDateTime
- Since:
- 2.5.0
 
- 
toOffsetDateTimeConverts the Calendar to a correspondingOffsetDateTime.- Parameters:
- self- a Calendar
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
toOffsetDateTimeConverts the Date to a correspondingOffsetDateTime.- Parameters:
- self- a Date
- Returns:
- an OffsetDateTime
- Since:
- 2.5.0
 
- 
toOffsetTimeConverts the Calendar to a correspondingOffsetTime.- Parameters:
- self- a Calendar
- Returns:
- an OffsetTime
- Since:
- 2.5.0
 
- 
toOffsetTimeConverts the Date to a correspondingOffsetTime.- Parameters:
- self- a Date
- Returns:
- an OffsetTime
- Since:
- 2.5.0
 
- 
toInstantConvenience method for converting a Calendar to a correspondingInstant.- Parameters:
- self- a Calendar
- Returns:
- an Instant
- Since:
- 2.5.0
 
- 
toZoneOffsetConverts the TimeZone to a correspondingZoneOffset. The offset is determined using the current date/time.- Parameters:
- self- a TimeZone
- Returns:
- a ZoneOffset
- Since:
- 2.5.0
 
- 
toZoneOffsetConverts this TimeZone to a correspondingZoneOffset. The offset is determined using the date/time of specified Instant.- Parameters:
- self- a TimeZone
- Returns:
- a ZoneOffset
- Since:
- 2.5.0
 
 
-