During the moment of conception, the gender of the baby is determined as female egg is XX and male sperm is XY if the result is XX it is a definitely female, if Xy it is a male
We can confirm this during pregnancy by ultrasound after 6 weeks of pregnancy