If I have been in hospital for 2 weeks and I have just returned home, I say "I have been in hospital for 2 weeks". It is a recent event. After I have been home for a few days I will probably say "I was in hospital for 2 weeks", because some time has passed, those 2 weeks are in the past. My question is: how much time should pass before you switch from present perfect to past simple? This is a grey area I find quite difficult.