Bender is (mostly) powered by alcohol. We also know that if he doesn't drink he grows a rust beard and acts similar to how a human would once they partake in too much alcohol. How long does Bender need to go without alcohol before he starts growing a rust beard and/or feeling the effects of not drinking?
In Season 1 episode 2 "I, Roommate" Bender leaves for the night, then after Fry decides to kick Bender out of the apartment, Bender stumbles into Planet Express the next day with a rust beard. The exact quote:
Leela: Look at that five o'clock rust. You've been up all night not drinking, haven't you?
Bender: Hey. What I don't do is none of your business.
From this we can assume as little as one day of not drinking is enough to get the iconic "rust beard".
Another episode that features bender sober, is the "The Birdbot of Ice-Catraz", the 9th episode of the third season. In this episode Fry and Bender are at odds over captaincy of the Planet Express ship, Fry walks out, and in the next scene we see Bender piloting soberly with the rust beard once again, not much longer after Fry left him.
Seems like the correct answer is "not much time at all" although Futurama has never been known for being consistent in these matters.
I think the "rule of funny" (warning: TV Tropes) applies here. It takes as long as the writers of the episode need it to take to be funny.
Edit: My bad. Should have warned about the link to TV Tropes. Then again, you didn't really want to be productive for the next two hours, did you?