Are you new to brewing in general? Or are you an extract brewer making the jump to all grain?
If it is the latter, your AG beer will last just as long as your extract in a bottle.
How long it will last will depend upon the style of beer and how you've stored it. If you store it cold and in the dark, it will last considerably longer than beer kept warm and in the sun. Some beer styles, like a big Barleywine, do well being aged months, or even years, before being drank. Other beer styles, like IPAs, should be drank fresh, before the hoppiness begins to fade.
Also, how long it will last depends upon your definition of what lasting means to you. If you mean how long will it be at its delicious prime, than this will be a much shorter time than if you mean how long will it physically be able to be consumed.