Pill query

How long do you need to be on the pill for it to offer protection? As in how many days?