The length of time depends on the type of infection being treated. For most bacterial infections, a course of 5-10 days is typical, but for conditions like malaria prophylaxis or acne, treatment may last longer. Always complete the full prescribed course, even if you start feeling better, to ensure the infection is fully treated.