If you want to find out the period of earth( i assume that you mean the period going around the sun), you should better use

instead of T^2 = 4pi^2*r^3/(GM)

The reason is that for T^2 = 4pi^2*r^3/(GM), it is only suitable for very large planet( primary body). In the other words, the earth should be much larger than the sun in order that the equation will be working. This is what i thought and please correct me if i've made mistakes