It's the flux that expires - so solder bars or solid wire don't have expiry dates but cored solder does. In practice, you used to be able to get away with it even if the solder was really old, because the flux had so much excess activity that it didn't matter - I have a huge roll of 63/37 Sn/Pb solder that was made in 1976 and uses rosin flux, and that will still work even with heavily oxidized component leads, despite being nearly 40 years old.
The current practice in electronics assembly is to use no-clean solder, and that has far lower flux activity - couple this with the widespread use of RoHS solder (which both doesn't wet as well and requires a higher soldering temperature that disperses what flux there is more quickly) and you get to the point where solder expiry is a real issue, although the figures quoted by the solder companies (which are typically 2 or 3 years) are still highly conservative.