The shelf life a product can best be described as a food quality issue. The manufacturer runs tests and determines how long a product remains in good, sellable condition (still maintains taste, color, appearance, nutrients, viscosity, etc). Expiration dates are about food safety; after this date the product may have a microbial count or species that renders the product unsafe for consumption.
The kinds of dates you will see on packages are:
- Best before/best if used by - these are food quality dates, not food safety
- Sell by - this is a food quality date & is for the retailer to manage stock rotation
- Use by - this is a food safety date, it is the last recommended date for consumption while the food is at peak quality
- Closed/coded date - these are lot codes used by the manufacturer for recall purposes
To further complicate matters, not all food that has hit its use by date is unsafe or of poor quality and not all food still within its use by date is ok or safe. How a product is handled has a lot to do with both its quality and safety. For example, a refrigerated product that has not been opened and has been held under 37*F may still be perfectly fine to eat after its use by date, while the same product opened and left on the counter every morning may be bad well before its printed use by date.
I can share some guidelines for the more common items often in question:
Milk - the packaging has a sell by date. If held under the recommended storage conditions (less than 37*F) it should be fine to consume for 5 days after its sell by date.
Eggs - if the carton has a USDA shield then there will be a mandatory pack date on the packaging (there may also be a voluntary sell by date) which is a 3 digit Julian code (Jan 1 = 001, Dec 31 =365). If there is a sell by date, it can be for no more than 45 days from the pack date. But eggs have a remarkable shelf life and are good for 5 weeks in the refrigerator; probably longer. The whites will thin out making sunny side up & hard boiled eggs not as desirable, but they are not a safety concern.
Canned Foods - typically don't have a date (other than closed/coded) on their packaging, but the rule of thumb is they are probably good for 2 years as long as they are not leaking, are not rusting and not bulging. It is best to use them within 1 year and hold them in a cool (less than 75*F) area.
Meats - best to eat or freeze within 2 days of purchasing, especially ground or processed meats. Meat has a pretty short refrigerated shelf life, but much longer frozen. Ground meat keeps in the freezer for 3 months, pork for 6 months, and whole meat & chicken for 12 months.
A good place to find additional shelf life information can be found here and here. I always recommend erring on the side of caution. Your nose knows - use it. If something smells funny or funky - don't eat it. Same goes with what you see; if liquid that was clear is now cloudy, or your lunch meats take on a iridescent green sheen, or something just doesn't look right - throw it out. I hope this helps give you some measure of confidence and helps you save some money by not throwing out good food just because of some date on a package.