Years. Aboard ship I always carried an ample inventory of oils--in case of the need for change or a leak, I would have all I needed for replacement. This oil was often several years old in sealed 5 gallon pails, in drums, or in a storage tank . There was never any visual difference in the oil nor in the analyses after the oil was put into service. In any case, the oil in the machinery was in service for several years in many cases...gearboxes, little used diesel generators, turbine sumps, very large diesel sumps, etc.
The biggest problem with buying lots of oil ahead is that if you keep reading this forum you'll come up with better ideas about which oil to use....
Ken