inHours property

int get inHours

The number of entire hours spanned by this Duration.

The returned value can be greater than 23. For example, a duration of four days and three hours has 99 entire hours.

const duration = Duration(days: 4, hours: 3);
print(duration.inHours); // 99 = 4 * 24 + 3

A negative duration has a negative number of whole hours, so that (-duration).inHours = -(duration.inHours).

Implementation

int get inHours => inMicroseconds ~/ Duration.microsecondsPerHour;