difference static method

Time difference(
  1. ZonedDateTime end,
  2. ZonedDateTime start
)

Subtracts one zoned date and time from another, returning an elapsed duration.

This is equivalent to start.ToInstant().timeUntil(end.ToInstant()); in particular:

  • The two values can use different calendar systems

  • The two values can be in different time zones

  • The two values can have different UTC offsets

  • end: The zoned date and time value to subtract from; if this is later than start then the result will be positive.

  • start: The zoned date and time to subtract from end.

Returns: The elapsed duration from start to end.

Implementation

static Time difference(ZonedDateTime end, ZonedDateTime start) => end.timeSince(start);