Usually, it will take few days to few weeks for a viral eye infection to last. But the situation may depend on the cause. And if you follow your doctors' suggestions, you will recover soon. But if you are suffering the chronic types of viral eye infection such as virus retinitis, you may need long-term care and treatment.
Sometimes, a viral eye infection is not serious. It will clear up on its own after a few days. But sometimes a viral eye infection may cause vision problems if treated untimely an inappropriate. So can you make sure that you got a viral eye infection? If you got this kind of infection, I suggest you to ask professionals for medical treatment. Usually, it will take you few days or few weeks to cure the infection.