Where I work we can keep code in version control for a differing range of times. I guess it depends on the suituation you find yourself in.
We have some code in there for over 1 year (maybe 2 or more) and some for only a few weeks. The reasons for this are our customers use different versions of the system and we must be able to provide support and fixes for a minimum of up to 18/24 months after deployment, so we need to keep the different version branches available to meet this requirement.
Also we can spend several months, if not years developing new versions so we need to keep this code during the development process.
I know it's a vague answer but I guess the answer to your question is the amount of time code is stored varies from project to project and place to place.
But you should use source control where ever possible! It will save time and stress incase the worst happens. I also believe it would be better to keep code for too long than to remove it early.