This really depends on what type of HIV test is done. Most labs now use what's called a ""4th generation"" HIV test. This type of HIV test detects antibodies against HIV - which your body produces in response to the virus, as well as HIV antigens which are part of the virus itself. It usually turns positive about 3 weeks after infection, and should definitely be positive by about 6 weeks after infection. If you are worried about an exposure to HIV that occurred more recently than 3 weeks ago, ask for an HIV viral load test (also called an HIV RNA test). This test will usually turn positive around 10 days after infection. Using currently available tests, it is difficult to detect an HIV infection that occurred within the last 10 days. [link to HIV testing page].
If you think you may have been exposed to HIV in the last 3 days, then you may be eligible to take PEP to prevent HIV infection.