The function that will help give you what you want is the “atan2” function. The way it measures the angle is counter-clockwise from the horizontal axis, and it gives an answer between $-180^\circ$ and $180^\circ$. Since you want to measure the angle clockwise, you need to add a minus sign, and since you want answers between $0^\circ$ and $360^\circ$, you need to adjust for that also. Can you figure out a nice formula for just what you want now?