Igneous rocks form from eruptions of lava or magma.Metamorphic rock is formed by great pressure far below the Earth's surface.Tools like radiometric dating allow some samples to be assigned a certain age to within some accuracy.
Radiometric dating, based on known rates of decay of radioactive isotopes in objects, allows a specific age of an object to be determined to some degree of accuracy.
Sedimentary rocks form from soil and silt carried and deposited by moving water.
Over time, the accumulated deposits compress and harden.
According to the law of superposition, as long as an area remains undeformed by outside forces, the deeper you go down through the layers of rock, the older they are.
So, if you know the ages of the layers in the parent and wall rocks, you can calculate the age of the layers in your subsided area or xenolith by matching them.