Whole coffee beans stored in an opaque and airtight container will be fresh for more than six months. But ground coffee will begin to lose its flavor in just two hours.