We get asked this questions occasionally, and I always remember the time I was watching a guy make espresso. He ground the coffee, and then had a slight problem with his espresso machine. The machine was fixed and ready to go within a couple of minutes, but he nonetheless declared his freshly-ground coffee “old,” discarded it and ground more coffee for his espresso shot.
Was that going overboard and an act of coffee snobbery, or was he correct?
Tough questions are tough to answer. The simple answer is that green (raw) beans last at least 2 years, whole roasted beans last 2 to 4 weeks if properly stored, and ground beans immediately start losing flavor once they are ground.
If you can buy green coffee beans and roast them yourself, you can ensure that you will always have fresh coffee. Most beans you buy, though, have no roast date on them, and expiration date are only so helpful, since they are made at the whimsy of the roaster.
The best you can do to ensure fresh coffee taste, short of roasting your own beans, is to buy whole bean coffee – preferably direct from a local roaster – and use it within a couple of weeks. If you buy ground coffee, consider getting a grinder, or just get used to the fact that your coffee will be lacking flavor.
Aside from all of that, though, I think the correct answer is that you can consider your beans no longer fresh when you can no longer deal with the taste – or lack thereof – of the coffee that they make. If you don’t mind drinking coffee that you bought ground 2 months ago, then consider yourself the better for your easy-going nature. If you think coffee you ground 2 minutes ago is now old and unusable, then go ahead and grind some more.