Skip to main content
Version: Java (Groovy)

plus

plus adds one time period to another.

Syntax

plus(instant, nanos)
plus(instant, duration)
plus(instant1, instant2)
plus(instant, period)
plus(dateTime, nanos)
plus(dateTime, duration)
plus(dateTime1, dateTime2)

Parameters

ParameterTypeDescription
instantInstant

Starting instant value.

instant1Instant

Starting instant value.

dateTimeZonedDateTime

Starting date-time value.

dateTime1ZonedDateTime

Starting date-time value.

nanoslong

Number of nanoseconds to subtract.

durationDuration

The time period to subtract.

periodPeriod

The time period to subtract.

instant2Instant

The time period to subtract.

dateTime2ZonedDateTime

The time period to subtract.

Returns

The starting time plus the specified time period.

Examples

dateTime = parseInstant("2020-01-02T00:00:00 ET")
duration = parseDuration("PT5H3M35S")

println plus(dateTime, duration)