offset property

Duration get offset

Gets the UTC offset for this date-time.

The offset represents how much this timezone is ahead (+) or behind (-) UTC at this specific date and time.

Example:

final summer = ZonedDateTime.of(
  LocalDateTime.of(2023, 7, 15, 12, 0),
  ZoneId.of('America/New_York')
);
final winter = ZonedDateTime.of(
  LocalDateTime.of(2023, 1, 15, 12, 0),
  ZoneId.of('America/New_York')
);

print('Summer offset: ${summer.offset}'); // -4 hours (EDT)
print('Winter offset: ${winter.offset}'); // -5 hours (EST)

Implementation

Duration get offset => _offset;