Early pregnancy

My period came on 6 days early it’s normally right on time. I went to hospital the day before my period started they told me I wasn’t pregnant could it have been to soon to test?