Fresh baking powder should be good for three to six months once you open the container. There should be a date stamped on the bottom of the can so you can tell if you're buying fresh baking powder in the first place. It begins to lose its ability to leaven baked foods when it comes in contact with moisture, so storing it is a dry place will increase its longevity. For the same reason, never dip a damp measuring spoon into the can.
The reason cornstarch is an ingredient in baking powder is that it helps keep the active ingredients - baking soda and cream of tartar or another acid - dry. But cornstarch can only do so much and only for so long. If you're not a prolific baker, you should be buying baking powder in small quantities.
To test the vitality of your baking powder, add a teaspoon of it to a third of a cup of hot water. If it foams and bubbles, it has enough oomph left. If it just sits there, it's time to run to the store or - here's a thought - you can make your own. Combine a tablespoon of baking soda with 2 tablespoons of cream of tartar and 1-1/2 tablespoons of cornstarch. It may not have the same potency as a good store-bought double-acting baking powder, but it will serve in a pinch.