Test - period

What’s the earliest you can take a pregnancy test if you’re unsure of your period/ovulation dates? Is it 2 weeks after sex?