How do food manufacturers pick those dates on their product packaging

How do food manufacturers pick those dates on their product packaging – and what do they mean? When does it all become dangerous to eat? Rich Johnstone,...