An opened beer could last a few hours no more. After that, use for cooking within a day, or toss it out. An unopened beer could last a couple of years if left in the cold and dark. Many craft beers are becoming available in cans now so they don't get any exposure to light.
You should check the expiration date. Even though some things seem to be still good after the expiration date, it is unhealthy to consume them because they begin growing bacteria and such, so you should always go by the expiration date when you determine that.
If kept in dry cool dark place it could last 5 mos up to 2yrs. I wouldn't drink anything older than 1 yr. It will have a flat taste low carbonation also called "skunky". not that it smells of skunk. I prefer good quality beers. European if I can get the real thing. Not the foam & slop / Bud Miller Coors. Never a light beer. yuck.