The discovery of radioactivity, and the ability to accurately understand radioactive decay helps scientists calculate the age of a rock via a process called Radioactive Dating.
Radioactive atoms are unstable, and over time they decay into stable atoms. As rocks form radioactive atoms are trapped inside and their rate of decay becomes predictable. By studying the how many unstable and stable atoms are in the rock scientists can estimate how long ago the rock was formed, and from that calculate its age.