Sex of the baby?

Hi! This is my first pregnacy and im really excited to know the sex of my baby but i wanted to know how many weeks do you have to be to know?