There are two ways to determine the age of a dinosaur fossil. One is called relative geologic time, which involves deciding whether one dinosaur fossil is older or younger than another. The other is often called absolute geologic time, which involves estimating how many millions of years old a dinosaur fossil is.
To determine relative age, one must realize that dinosaur fossils are preserved in layers of sedimentary rock, which are deposited in sequence, one on top of the other. Fossils contained in an older, lower rock layer are relatively older than fossils contained in a higher, newer layer.
The sequences of rock layers containing dinosaur fossils often also contain layers of ancient volcanic ash, and the ash is composed of minerals crystals formed at the time of the eruption, which contain radioactive atoms. These atoms break apart at a constant rate in a process called radioactive decay. Using sophisticated scientific instruments, geologists can measure how long it takes for half of the parent atoms to decay into daughter atoms, a time period called the half-life. Geologists then measure the proportion of parent and daughter atoms present in the ash crystals to determine the crystal's age.