You can be contagious from a few days up to two weeks or more, depending on which virus is causing your stomach flu (gastroenteritis). A number of viruses can cause gastroenteritis, including noroviruses and rotaviruses.