In addition to how the milk is pasteurized, and whether you touch the opening, and whether you leave or on the counter, it depends on how cold your fridge is. Mine is barely above freezing (sometimes slightly below freezing) and I’m constantly surprised at how long our milk keeps.
Also, the ultra pasteurized stuff keeps a lot longer after opening it than the regular milk does, presumably because we don’t generally contaminate either, and the UP milk starts with less stuff that can grow.