Let $p$ be a prime number and $G$ a non abelian group or order $p^3$. Prove that $Z(G) = [G,G]$. 
Let $p$ be a prime number and $G$ a non abelian group or order $p^3$. Prove that $Z(G) = [G,G]$.

I have already figured out that $|Z(G)| = p$, and that $G'=[G,G] \lhd G$.
Also, $|G'| = p$ or $p²$.
I suppose I'd have to prove that $G' \subset Z(G)$, but I've been trying and I have no idea how. Any hints? Thanks!

Hint (assuming that with $[G:G]$ you mean $G'=[G,G]$, the commutator subgroup): since $G$ is nilpotent, $G'\ne G$; can $Z(G)$ have index $p$ in $G'$?
