Sedimentary rocks are layers upon layers of sediments. Let's say that in a certain year, there was a disturbance in a body of water which caused the composition of sediments to look different than other layers of sediments. Then after a few million years, assuming that that layer hasn't been disturbed, someone can look at it and say, oh, something unusual happened at this time.
Sedimentary rocks are also where scientists find fossils. For example, in a marsh, a dinosaur dies and its corpse falls into the mud. After some time, the mud would harden and another layer of mud or other sediments would build up on the body. These layers would grow until some archaeologist finds it.