There were alot of vairables involved that dicated how long they were in port.
If you feel like doing a little bit of research, heres a great site.
http://www.uboatwaffe.net/
You can look up when uboats went on patrol.
http://www.uboatwaffe.net/ops/boat.cgi
For example, heres U505
http://www.uboatwaffe.net/ops/boat.cgi?boat=505
Look closely at when they went on patrol, and the time between patrols. Having read a book about this boat, i know they were subjected to ALOT of sabatage which made the boat return to port alot.