Preg test accuracy

How many days before a missed period can a pregnancy test be accurate?