Both Radioactive dating of rocks retrieved from the world and Comparing cratering rates on one world to those on another.
Geologists can find the relative age of impact craters on a world because
the ones on top must be younger.
Scientists know the history of Earth's magnetic field because the magnetic field gets frozen into rocks, and plate tectonics spreads them out.
Hope it helps