"A year on Mars lasts 687 Earth days and a Mars day at 25 hours is almost the same as an Earth day"

Day length of a planet apparently is unrelated to its position in it orbit. I wonder what made day lengths so close on Mars and Earth.

Here's a URL with a lot of data for all the planets:
http://www.angelfire.com/moon/astronomy/planets.html