Sedimentary rocks contain a record of the changing forms of life on earth. It is not a complete record; most creatures get eaten, rot, or are otherwise destroyed. Many do not have any resistant parts and, of those that do, the remains may later be eroded or never found. Although material from the original shell or bone may survive, it may alternatively be replaced by other minerals or leave just a faint imprint in the rock.
Even so, fossils provide a remarkably detailed picture of life on Earth. It is a picture of rapid diversification and great inventiveness to suit every ecological niche, punctuated by rapid extinctions when times get hard. Thus the changing fossil record provides a powerful means of dating rocks. So called zone or index fossils have been picked as key markers for each time. Ideally they are common, free swimming species that can help correlated rocks of the same age wherever in the world they are found. Sometimes, finding assemblages of different fossils together at one location can narrow the time down further.
Fossils and stratigraphy reveal relative ages of rocks, but not an absolute age. For that, geologists have other techniques. They can simply count the growth rings in trees. Modern mass spectrometers can measure even the slightest trace of an isotope, so tiny crystals can each be dated. Thus the oldest minerals on Earth were found: grains of zircon over four billion years old, eroded and redeposit later. The key to accuracy is purity of the sample. If the sample comes from a lava, its melting will have released any previous gas and reset the clock.