isBefore

isBefore compares two date-times and returns true if the first parameter comes before the second parameter.

Syntax

Parameters

ParameterTypeDescription
instant1Instant

The first date-time for the comparison.

instant2Instant

The second date-time for the comparison.

dateTime1ZonedDateTime

The first date-time for the comparison.

dateTime2dateTime2

The second date-time for the comparison.

Returns

Returns a boolean value:

  • true if the first date-time comes before the second date-time.
  • false otherwise.

Example

The following example shows how to use isBefore to compare two Instants.