Do ovulation cramps occur before, during, or after ovulation?

Do those sharp pains mean you're ovulating? And it's a good time to have sex?

Or does it mean soon you will be ovulating and that's the first step... I'm new to this just needed advice