How long does it take for the earth to rotate on its axis?
It takes a day for the Earth to rotate about its axis, but there are several definitions of a day.
The period it takes the Earth to rotate about its axis is called a day. There are however several definitions of a day which are all slightly different. It all depend on what you measure the time relative to. Also, due to orbital effects successive days are not the same length.
A Mean Sidereal Day is one complete rotation of the Earth relative to the fixed stars - 23h 56m 4.1s
A Mean Solar Day is 24h or 86,400s which is what clocks measure.
A Solar Day as measured by a sundial is between 24h-20s and
24h+30s. The Solar Day length various continuously from day to day. The Solar Day and Mean Solar Day are only the same length on 15 April, 13 June, 1 September and 25 December.
The reason why the Solar Day changes from day to day is due to the Earth's orbit being elliptical and the axial tilt.
The orbital eccentricity component is the orange line on the diagram. It have zeros at the apses.
The obliquity component, due to the axial tilt, is the green line which has zeros at the equinoxes and solstices.
The difference between the Mean Solar Day and the Actual Solar Day is described by the Equation of Time which is the blue line in the diagram and is the sum of the two components. The vertical axis is minutes difference between clock noon and solar noon.