Skip to content

Instantly share code, notes, and snippets.

@mvervuurt
Created August 9, 2017 12:10
Show Gist options
  • Save mvervuurt/cf720035ecc7af8cf80657c080440c36 to your computer and use it in GitHub Desktop.
Save mvervuurt/cf720035ecc7af8cf80657c080440c36 to your computer and use it in GitHub Desktop.
TimeDiff based on OffsetDateTime
val endDateTimeOffset = endDateTime.getOffset.toString
//Create OffsetDateTime in chosen timezone with correct Offset
val startDateTime = OffsetDateTime.now(ZoneId.of(endDateTimeOffset))
val timeDiff = ChronoUnit.HOURS.between(startDateTime, endDateTime)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment