Generally speaking, good-quality ammunition has a shelf life measured at least in decades, as others here have already noted.
HOWEVER....there ARE exceptions.
Back around 1990 and living in Canada at the time, I bought several 1000-round cases of Portuguese (FNM) 7.92x57 Mauser ammo, headstamped and case-dated 1983-84....well under 10 years old. It was gorgeous, brilliantly shiny, and had no cosmetic issues at all.
I'd bought it to feed our MG42, and it worked quite well at first except for an occasional misfire, amounting to maybe 1 in 150 or 200 rounds. However, it got progressively and noticeably less-reliable, until in 1997, just before we left Canada, I fired-up the last of it (on videotape), and I'll wager that 50%, (HALF) of the 400 rounds I tried to fire that day were duds. Not hangfires, just plain DUDS. MG42 REALLY smacks the primers, too. It wasn't gun problems that caused the ammo to work so poorly!
Other batches of FNM ammo I've seen and used have been excellent, these being mostly 7.62x51 NATO. It's plain to me that periodic inspection and test-firing had revealed this 7.92mm stuff to be faulty, and that's why it was condemned and sold as surplus so soon after manufacture.
If recent-manufacture military ammo is going cheaply, there MAY be a good reason for it. Be aware.