Rocks age away from the mid-ocean ridge is older otherwise younger. Rocks magnetic pattern changes when there is a magnetic reversal.
This answer is my own opinion only.
When scientists studied the magnetic properties of the seafloor, they discovered normal and reversed magnetic stripes with different widths. These magnetic patterns are parallel to the mid-ocean ridges and symmetrical on both sides. This is how scientists determine the age of the seafloor.