Confusion regarding sinusodial function in SHM A block is connected to a spring. The block is pulled from the initial position $t=0$ and $x=0$ to lets say Zcm and released. Now if I have to write the SHM equation when the body is Z/2 distance away from mean position, do I use sine or cos?
I get it that Z is the Amplitude. So do I start measuring time from t=0 or t=t i.e. when body is at Z
 A: You have to start measuring time when the block is at $x=Z/2$ because you don't really know how the block is moved to $x=0$ to that position. You can consider the moment when the block is released as $t=0$ because choosing a different time origin won't affect the behaviour of the system (you have no friction).
It doesn't matter if you choose sine or cosine if you match the initial condition and you can do that with both choosing a different phase ($\delta$) depending on whether you use sine or cosine. However, $\cos(0)=1$ so you won't have to choose a phase if you use the cosine.
A: The initial moment of time $(t=0)$ is generally taken when the motion started, i.e., in your case when the block is at $x=Z cm$. However, you can choose any moment of time as $(t=0)$ after the motion started as per your convenience. 
You can think of it this way - You closed your eyes when the block was at rest at $x=0$ and some naughty kid pulled the block to $x=Z cm$ and when you opened your eyes $(t=0)$, the block was at $x=\frac{Z}{2} cm$ and was moving towards the mean position $x=0$. 
So, after observing for sometime, you will write the equation as - 
 $$x=Zsin(\omega t + \delta) $$
 and as the block was at $x=\frac{Z}{2} cm$ at $t=0$,
$$\frac{Z}{2}=Zsin(\omega (0) + \delta) $$
which gives $\delta = \frac{\pi}{6}$.
So, the equation of motion will be - 
$$x=Zsin(\omega t + \frac{\pi}{6}) $$.
Note that if you use $cosine$ instead of $sine$, only $\delta$ will change but the initial phase of both equations will be same as $cosine$ and $sine$ have a phase difference of $\frac{\pi}{2}$, i.e., $sin(x) = cos(x - \frac{\pi}{2})$
