I think a lot depends on what it is and how it's stored. Whole spices like seeds and peppercorns that still have their natural protective coatings will last a long time if tightly sealed. I have a huge jar of garlic powder that I have had for about five years that will still knock you over when you pop the lid. It's still overpowering if you use too much. Crushed green herbs not so much. I think they continue to dry out and lose natural oils pretty quickly. Heh if it still tastes good in your cooking I would use it. Or at least in dishes in your daily cooking where it's not real critical.

P.S. I might add that in the future I wouldn't buy a giant jar of garlic like that again.

It really depends on the spice. Keep cool and dry and in a dark place and wherever possible buy whole spices and grind as you need them. I seal mine under a very light vacuum when I first get them. If someone says it will "keep for years" then don't take that as gospel. It may have already been laying in a warehouse or in a store room for a year before it even reaches you. Buy them from a specialist shop that is likely to have a high spice turnover - that way they are more likely to be fresher. The best way is to not buy more at any one time than you are likely to use within 6 months and keep them turning over.

As has been said above whole peppercorn, coriander (cilantro) seed, fennel, cumin etc. will last a year or two as seeds but things like green dried herbs will often lose much of their flavour after a few months once opened. In supermarket packets they often come in smaller sachets packed under an inert atmosphere to keep them fresh - but this is unusual if you buy them in jars or if you buy them in bulk.

That 10Kg of dried parsley that you got cheap by buying in bulk may not be such a good deal when in 5 years time you are still using it and it is adding about as much flavour to your food as shredded newspaper