The simple harmonic oscillator is solved by the differential equation
$$
\frac{d^2x}{dt^2} = -kx
$$
This differential equation is second order, so it needs two initial conditions. This means that you likely need two constants. It turns out that there are multiple ways to write this solution (taking $\omega = \sqrt{k})$:
$$
x(t) = A \sin \omega t + B \cos \omega t
$$
where $A, B$ are found by $x(0)$ and $\dot{x}(0)$,
$$
x(t) = C \sin ({\omega t + \delta_1})
$$
where $C, \delta_1$ are found by the initial state, or
$$
x(t) = D \cos (\omega t + \delta_2)
$$
where $D, \delta_2$ are found by the initial state.
You may also see a solution written as $A e^{i \omega t}$, which can be related to the other solutions by taking the real part of Euler's formula.
These are all possible since the components share the same frequency and are only out of phase with each other. $\sin x$ and $\cos x$ are 90 degrees out of phase, but the additional phase factors $\delta$ make it so that either solution will work; you just have to solve for the constants with initial conditions.