Skip to main content
Version: Java (Groovy)

minus

minus subtracts one time period from another.

Syntax

minus(instant, nanos)
minus(instant, duration)
minus(instant1, instant2)
minus(instant, period)
minus(dateTime, nanos)
minus(dateTime, duration)
minus(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 minus the specified time period.

Examples

d1 = parseInstant("2020-01-02T00:00:00 ET")
d2 = parseInstant("2020-01-01T00:00:00 ET")

println minus(d1, d2)