Pick a couple of random boats out from this:
http://uboat.net/boats/patrols/boats.html
There didn't seem to be any set time. U-99 spent only 4 days in Lorient between Patrols 2 and 3 and 8 days between Patrols 5 and 6, though that was more the exception than the rule. U-552 usually had stays of 20-30 days for example.
Repairs, overhauls, and equipment additions would have added more time spent ashore as well.
T