the time t for a pendulum to swing back and forth once is called its period and is given by t=2pi*sqrt l/g where l equals the length of the pendulum solve for g

t = 2π√(l/g)

t/2π = √(l/g)
(t/2π)^2 = l/g
g = l / (t/2π)^2 = 4π^2*l/t^2