code: private static long dateTimeDifference(final Temporal d1, final Temporal d2) {
        return ChronoUnit.SECONDS.between(d1, d2);
    }
docs: Calculate the difference between two datetime to the unit.
  
  @param d1 first datetime
  @param d2 second datetime
  @return the difference