Is there a equivalent to ChronoUnit.between that returns fraction instead of integer?
问题 Methods such is ChronoUnit.HOURS.between(start, end) returns long so I can't get the fraction from there. Is there an alternative method/approach that would return a fraction? 回答1: The whole point of ChronoUnit.HOURS.between(start, end) is to get the number of HOURS between the two timepoints. For example: it's either 1 or 2 hours between, there is no such thing as 1.5658 hours*. If you need more precicion, use another ChronoUnit, i.e. Minutes or seconds. The problem with decimal fractions is