The IRS has not defined the holding period requirement, so there is no definite safe harbor. A previous PLR (PLR 8429039) stated that 2 years is sufficient, but there have been tax court cases where less than 2 years was adequate time. Best bet, stick w/ 2 years.
I have a piece of land that is on the market for over 1 million dollars. If I invest this $ in a 1031 tax free like kind exchange and purchase homes with the profits, is it 2 years or 3 years before I can move into these properties as my primary residence without having to pay capital gains taxes?