countHours function

String countHours(
  1. int difference
)

Converts the time difference to a number of hours. This function truncates to the lowest hour. returns ("1 hour" OR "X hours")

Implementation

String countHours(int difference) {
  int count = (difference / 3600000).truncate();
  return count.toString() + (count > 1 ? ' hours' : ' hour');
}