When your pregnant how long does it take to know if your going to have a boy or a girl?

A sonographer can tell from an ultrasound from 14 weeks onwards. This depends on the position of the baby though.