SpongeBob had time till sunset. After that, the pie would hit his lower intestine, causing him to explode and die. So by looking at medical research, SpongeBob had about 3 to 4 hours till that happened.