// convert hours to 12-hour format
hours = ((hours + 11) % 12 + 1);