Bottled beer can last over a year if everything is properly sanitized and you store it properly. Naturally its better to store it cold, and out of sunlight. I've tasted several great brews over a year old. If you are going to store it a long time, oxygen absorbing caps might help.
Kegged beer can be stored longer - largely because it is stored with pressurized CO2 (no air to oxidize it) and also no light inside the keg. I have one on tap now that is about 1-1/2 years old and it tastes great.
Quite a few variables enter into the age equation - oxidization, sunlight, temperature, degree of starch conversion (which affects taste stability), alcohol content (higher will last longer), hop level (more hops helps preserve the beer), carbonation level and others.
Cheers!
Brad