0x686169 - 9 months ago 52

Objective-C Question

`1.30 AM -> 45 Degree`

0 AM -> 90 Degree

3 AM or 15 PM -> 0 Degree

9:00 AM -> 180 Degree

Cound you please show me formular to calculate NSDate to Degree ?

Answer Source

I think the convention is that every 1 hour corresponds to 360/24 = 15 degrees. So 3AM * 15 = 45degrees. 2pm * 15 = 30 degrees. However, if you set your zero at 3AM as you are doing with your numbers, then your formula would be (3-hours)*360/12. So 3AM = 0 degrees. 1.5 = 45 degrees. 0am = 90degrees. 9am = -180degrees.