Stomach viruses usually go away within 7 to 10 days.
When you have a stomach virus avoid eating anything that contains dairy and avoid drinking any milk.
If your stomach virus lasts more than 10 days then it could be something more serious and you should see a doctor since a normal stomach virus should go away within 10 days.
When you have a stomach virus you should stay hydrated and drink things such as water or tea and even drink some pedialyte to help replace lost electrolytes in your body.