What time is it?
The time is HOUR : NICE_MINUTE AM_PM
The small hand is for the hour, and the big hand is for the minutes.
The hour hand is pointing at HOUR
, so the hour is HOUR
.
The hour hand is between HOUR
and HOUR + 1 === 13 ? 1 : HOUR + 1
, so the hour is HOUR
.
The hour hand is close to but hasn't passed HOUR + 1 === 13 ? 1 : HOUR + 1
, so the hour is still HOUR
.
The minute hand starts pointing straight up for 0
minutes, and it makes a complete circle in one hour (passing by all 12
numbers in 60
minutes).
For each number that the minute hand passes, add \dfrac{60}{12} = 5
minutes.
The minute hand is pointing at (MINUTE / 5) === 0 ? 12: MINUTE / 5
, which represents 0
5 \times (MINUTE / 5) === 0 ? 12: MINUTE / 5 = MINUTE
minutes.
The time is HOUR
:NICE_MINUTE
.