the best way to make sure your fish food is still good is to only buy enough for about 2-3 months of feeding. that said, alot of people buy their fish food in bulk and will freeze the dry foods so that they retain their nutritional value.
I would advise against using stale foods to fish. They are one of the many reasons why fish suffer digestive problems. IMO, if a package has been opened several times beforehand and had lapsed two months, it's time to throw that in the bin. A month for flakes since flakes by this time have degraded rapidly. Vitamins are easily destroyed by air and light alone.