When Does Ovulation Occur In A Woman?

When exactly is ovulation for a woman, I heard 2 weeks but I just want to make sure. Also, I realize you’re most fertile during ovulation, but if you’re trying to get pregnant how long after having sex should you take a pregnancy test and get an accurate result?