This varies from person to person and refrigerator to refrigerator. It depends on many factors such as:
- The age of the cheese when you bought it;
- Whether or not it has been opened (shelf life goes down drastically after opening);
- The amount of moisture in the cheese;
- The amount of moisture in your refrigerator;
- The amount of time exposed to open air (if opened);
- The quality of the seal (if resealed).
And so on. I can personally attest to both Reggiano and Grana Padano growing mold after only two weeks in my cheese drawer (yes, I have an entire drawer for cheese) after opening it, and at least 3 months unopened. It might last more than 3 months unopened, but cheese never sits around that long unopened at my place...
However, since this question is about hard cheeses, it's useful to know that mold is not a deal-killer. Unlike soft cheeses, where mold can grow roots and spread throughout the interior (even if you can't see it), mold can generally only grow on the surface of a hard cheese. So if you've been keeping it in your refrigerator and start to see mold after a few weeks - don't worry about it! Just cut the mold off and store it again.
I've made opened cheese last up to 2 months this way, by simply cutting off the outer layers that are starting to grow mold. If you're conscientious about it, you won't have to throw anything out.