I bought a jar of grated Parmesan cheese that has a "use by date" three months from today. Has that jar been on the shelf a year, six months, three months, how long? Do Kraft, Sargento, Signature Kitchens, etc. all have to use the same amount of time between packaging and "use by" dates, i.e. for Parmesan cheese 1 year, six months, etc., or can they just pick a shelf life out of the air based on their "calculations?" Please note: this has nothing to do with how long it lasts after I open it, but instead, how long has it been on the shelf. Thanks
It probably hasn't been there very long, a few days to a few weeks at most. Shelf space in a grocery store is very valuable. They want to use it for products that move, not for inventory. Some vendors even have to pay a slotting fee to the stores to keep their products there.
That's not to say it was made yesterday. It may have sat in a manufacturer's or distributor's warehouse for months. Again, they don't want to pay the costs of inventory, but the logistics of manufacturing sometimes mean that they have to make a lot of stuff at once and store it. That would be most obvious for something like seasonal fruits, such as cherries, which are harvested all at once, canned, and then kept in warehouses before being shipped to retailers.
I don't know how far they'd set the "best before" date for grated hard cheese. It probably varies from manufacturer to manufacturer. I wouldn't have anticipated it being much more than three months, but if you've got a jar with a three-month date then it was probably at least six. Which means it could well be three months old before you bought it.
But it probably spent little of that time taking up shelf space.
Expiration (use by or sell by) dates do not come out of thin air, since the actual meaning of this expression is the limit date that the manufacturer is liable for the quality and stability of the product as long as recommended storage conditions are followed.
Manufacturers (usually the big ones) have extensive documentation proving this through stability studies performed in a whole lot of different conditions and the small manufacturers typically draw on the experience and documentation of the big manufacturers - similar products behave in similar ways if no extensive changes are done to the formulation.
If you're curious, you can find a lot of this information in patent filing :)