FRIDAY, Oct. 15 (HealthDay News) -- Maybe it's not so bad that children gorge themselves on candy on Halloween.

Parents who plan to hide most of their kids' ghoulish loot and dole it out to them later may be surprised to learn that even candy can go bad -- especially if it's made of chocolate.

Sweets do indeed have a shelf life, according to a Kansas State University expert.

This shelf life can vary anywhere from two weeks to a year, depending on the type of candy, packaging and storage conditions, Karen Blakeslee, an extension associate for food safety, said in a university news release.

Hard candies may last indefinitely, but people have suffered salmonella poisoning from eating expired chocolate.

Signs that chocolate candy may be past its expiration date include a texture that is extremely sticky or grainy, a flavor that seems "off," a change in color, or (in fruit-and-nut chocolates) mold, said Blakeslee.

In general, the softer the candy, the shorter its shelf life, she said, adding that the best way to store candy is in a cool, dry and dark place.

"The less exposure to air, the better," she said. "Also, store it at room temperature. Heat can cause many candies to melt and get too sticky. Chocolate can get a powdery look to it -- called bloom -- because of temperature changes, but it is still fine to eat."

And if you suspect candy is past its shelf life, she said, throw it away.

More information

The Nemours Foundation offers Halloween candy hints.