Fresh coffee is best. One of the factors involved in the freshness of coffee is carbon dioxide. Bookofjoe shared this great little tip from Cooks Illustrated.
To check if your beans are fresh, scoop 1/2 cup into a zipper-lock bag and press out all the air, then seal the bag and leave it overnight. If the beans are within seven to 10 days of roasting, they will make the bag puff up from the carbon dioxide that they release. If the bag remains flat, then the beans are not producing gas — a sign they’ve passed the point of peak freshness.”
And this graph…