There doesn't seem to be a "rule" as to when you should replace your helmet. Like most things it will depend on how much you use it. A general guideline to follow would be;
Your helmet should fit onto your head without creating any pressure points. If your helmet feels slightly snug when trying it on, it will feel like its squeezing your head by the end of a two hour ride. The hemet shouldn't be to big either, the idea of the helmet is to absorb the impact of a fall, it won't do this if it starts two inches away from your head. Once you determine what helmet fits onto the tip of your head, use the tension adjustment at the back of your helmet to dial in the fit. Your helmet should stay on your head with no straps on when you tilt your head down. Next is to fit the strap around your ears, there is an adjustment that can be made just below the ear. Last but not least is to adjust the strap under your chin. No more than two fingers should be able to fit in and you definitely don't want to choke yourself! Find the right place.
There are people who think that we don't need helmets, but having worked in a shop long enough, I have seen first hand the brain damage that can occur and the broken helmets that have saved many heads.
I Love cycling. Love to explore on my bike. Love to explore food that fuels my ride.