getHour function

int getHour(
  1. int hour
)

Implementation

int getHour(int hour) {
  if (hour > 12) {
    return hour - 12;
  } else if (hour == 0) {
    return 12;
  } else {
    return hour;
  }
}