The material (heavier than helium) that makes up the solar system was made in millions, if not hundreds of millions of stars that lived and died in the ~7 billion years between the formation of the Galaxy and the birth of the Sun. This material has been thoroughly mixed in the interstellar medium and so the heavier elements arise from countless individual stars of different ages. You can say something probabilistically, based on what we understand about the build up of chemical enrichment in our Galaxy.
Starting with hydrogen - the vast majority of hydrogen is primordial. That is, it hasn't been inside another star.
The carbon in the solar system is made in a variety of stars. Some will come from high mass stars and dispersed either when they exploded as supernovae or via winds from their surfaces during the Wolf-Rayet phase; some will have been manufactured in lower mass asymptotic giant branch stars and expelled in their winds. The distinction is important - massive stars enrich the Galaxy very promptly (see below, when discussing oxygen), near the beginning of the life of the Galaxy, long before the Sun was born. The enrichment rate by supernovae and massive stars tailed off considerably at later times. On the other hand, enrichment by lower mass stars takes longer because of their longer lifetimes. Thus the carbon in the solar system will have a spread of ages from about 13 billion (the oldest stars in the Galaxy), right up to the age of the Sun.
Elements like oxygen, phosphorus, magnesium, sulphur and silicon are primarily made and dispersed by massive stars and supernovae. These are likely to be at the older end of the range discussed above. On the other hand, nitrogen is also made in a mixture of stars, both high and low masses, with a consequent range of ages.
Iron and nickel are mostly dispersed into the interstellar medium by type Ia supernovae. These are exploding white dwarfs, which in turn are the remnants of comparatively long-lived stars of a couple of solar masses or so. Most likely, these elements were made not long before the Sun was born.
See also Parent stars of our Sun - Where are its remains? and How can there be 1,000 stellar ancestors before our Sun?
A more technical description of this differential enrichment history can be found in Pippino & Matteucci (2008).