Baby gender

So how many weeks do you have to be to find out if you are having a boy or a girl?