Gastroenteritis or the “stomach flu” is a common illness that is caused by a virus or bacteria. Gastroenteritis can usually be managed at home, and usually resolves in a few days but can last 1 to 2 weeks. The main goal in treating gastroenteritis is preventing dehydration.