When to test after sex?

My period is unreliable and i never know when it will come exactly. So how many days after sex can i take a test and it be very accurate??