$m\ddot{x}=-kx\implies \int m(\dot{x}\ddot{x})dt=\int -kx\dot{x}dt$

$m\dot{x}^2/2=-kx^2/2+C$

Worth noting $C$ is a constant of motion, the total energy.

$\dot{x}=\sqrt{2C-kx^2}/\sqrt{m}$

$\frac{dx}{\sqrt{(2C-kx^2)/m}}=dt$

Integrate both sides, the left using trig substitution. Can you take it from there?