The time it takes to get over a viral infection depends on the strain of the viral infection but most people recover from viral infections within 2 days to 2 weeks.
But some viral infections may last up to 3 weeks and if the viral infection lasts longer than 3 weeks then it would be advised to see a doctor to make sure the viral infection isn't more serious.
When you have a viral infection you'll be contagious for up to 2 weeks after the onset of the viral infection.
Since viral infections don't go away with antibiotics the only treatment you can do for a viral infection is to take over-the-counter fever reducers, such as acetaminophen or ibuprofen.