Be careful! That produces the wrong result for the first hour after midnight, as well as the first hour past noon. Somewhat tangentially, see also [Confusion at noon and midnight](https://en.wikipedia.org/wiki/12-hour_clock#Confusion_at_noon_and_midnight) (wikipedia).