As dinosaurs and other fossils don’t come with a date stamped on them, geologists have to use evidence from the rocks in which they are found to ascertain which geological period they belong to. The absolute ages of rocks in millions of years can be estimated accurately using the decay of radioactive isotopes. However, relative ages (eg Triassic or Jurassic) are normally determined using particular fossils, such as ammonites, that lived only for short lengths of geological time. In the case of dinosaurs, tiny plant spores and pollen usually allow them to be placed into the correct geological period.
Plus, take a look at: