It has been suggested that the risk of hospital infection differs according to the moment of hospital stay. Through a retrospective cohort of 843 surgery patients the effect of several factors on nosocomial infection risk is studied as a function of the duration of the hospital stay. It was observed that the studied variables (operation, type of surgery, age and severity of underlying disease) had a predisposing effect on the appearance of infection in short stays (less than 14 days), being the effect greater in longer stays. It is concluded that hospital stay can act as a modifier of the effect of several factors on the risk of hospital infection.