How many weeks do you have to be pregnant for before you can give birth?

They say 40 is full term because contraception which is like two weeks counts as part of your term. But in all actuality it is 38. Anything over is getting dangerous because your placenta stops producing the neccesities for the baby.