k is the spring constant and x is the displacement (the force is the restoring force)
For this equation to be approximately accurate, x needs to be below the spring's elastic limit. If x is more than the spring's elastic limit, the spring will exhibit "plastic behaviour" meaning that it will not return to its original position.
potential energy stored in a compressed recoiled spring
T is the period, m is the mass, and k is the spring constant.