Both premixed and powder formulas have an expiration date clearly stamped on the can.
Like all foods, even formula expires. Once you have opened a can of powdered formula, it needs to be used within 30 days. Once you have opened a can of ready-made, liquid formula, it should be used within 24-28 hours. All cans are stamped with a "use by" expiration date to indicate their shelf life.
It's a good idea to check the expiration date when purchasing your formula and to regularly check expiration dates from cans that might have been in your pantry for a while. Rotate them putting the oldest cans in front so as not to be faced with expensive expired formula. When in doubt, throw it out!