I would say his iv bag was still in him so I think he could have lasted about a weak. However, in the flashback it shows Shane trying to rescue Rick but the power goes out. But the out break seems to have already gone global ande the zombies were already in huge numbers. 

Since they live in a somewhat remote area it may have taken time to get there so the hospital could have kept him alive as the infection continued to ravage the state so he could have been kept alive for months as the infection started then woke up shortly after the power went out.