First of all, here's Jonah Goldberg's (perennial) Groundhog Day column; I completely agree with his contentions that it's great comedy and a great moral lesson. But how long was Bill Murray stuck there?
Director Harold Ramis, in the DVD commentary, opined that it takes Murray's character about ten years of repeating Groundhog Day and then later, in response to several sites online running an article that came to an answer of just 8 years, 8 months, and 16 days, he offered the following:
"I think the 10-year estimate is too short. It takes at least 10 years to get good at anything, and allotting for the down time and misguided years he spent, it had to be more like 30 or 40 years…"