Gravity’s effect on a vertical spring-block simple harmonic oscillator I just found a question in my textbook which asked how the period of the vertical oscillation will change if the spring and block system is moved to the moon, and the gravity due to acceleration is cut to one-sixth of the gravity on Earth. 
The answer is that the period stays the same, because gravity does not affect the period of the spring-block oscillator. I know this from the equation used to find the period, but I’d like to know just why exactly does gravity not make a difference in the speed in which a cycle is completed. Is it because the block is slowed down while going upwards just as much as it is sped up when going downwards?
EDIT: Hey guys, I’m just a high school student who barely understands physics. I really, really appreciate you all taking the time to answer my question, but I don’t understand your explanations. If possible, a simpler explanation would be super helpful.
 A: In the case of 1-D harmonic motion a constant force cannot change the the time period. The constant force simply shifts the equilibrium position of the harmonic motion. That is to say, it shifts the motion by a distance $\frac{mg}{k}$ (the distance the spring would stretch due to the mass if there was no brownian motion).
We can think of it in this way: If the string is stretched by a distance $\frac{mg}{k}$, a constant force equal to $mg$ is applied on the block by the spring (in a direction opposite to gravity). This force is cancelled out by the constant gravitational force. There is no difference in the motion if we stretch the spring a bit and apply a constant force -- just a displacement of the whole motion
$$ma=-kx+mg $$
replace $x$ by $x_{eff}$ such that $x_{eff}=x- \frac{mg}{k}$. Therefore
$ a_{eff}=a \hspace{2cm} ma_{eff}=-kx_{eff}$
Therefore by adding a constant to $x$ we can get the standard harmonic motion expression
You can also explain vaguely based on the slowing down and fastening up without considering the change in the equilibrium position. If we see the motion in the displaced frame there is absolutely no change in motion. It is better to see that the constan force is completely nullified due to the stretch in the spring
A: Consider the net force acting on the block at any moment. It is the force imparted by the spring plus the force imparted by the gravity. The force imparted by gravity is just mass times gravitational acceleration. So this remains practically constant as the block is moving up and down. 
For harmonic oscillation the force actually has to change in proportion to the distance from equillibrium point. Since the force imparted by gravity does not change at all it does not have any effect on the simple harmonic motion.
However it does have effect in determining the equillibrium point. If gravity is increased then the equillibrium point will become lower (in other words the spring will be more stretched). But the block will move around the equillibrium point in the same way.
A: I think this could be explained based on the principle of superposition.
When we analyze the trajectory of projectiles, we consider vertical forces, accelerations and velocities independently form horizontal and then combine or superimpose the results. This could greatly simplify the analysis and does not affect the results as long as the system is linear.
Applying this approach to the spring-block oscillator, we can observe that the force of gravity acting alone would just cause the spring to slightly stretch with no continuous movements.
In the absence of gravity, the spring-block oscillator would oscillate and the frequency of the oscillations would be defined by its internal properties, the spring constant and the mass of the block.
So, if the slight stretch of the spring due to the action of the gravity, did not change the spring constant (or mass of the block), we could combine the actions due to the gravity and due to the internal spring-block properties and we should find that, in the presence of gravity, the spring-block will oscillate with the same frequency as it did in the weightless situation, around a slightly shifted neutral point.   
