My question is how long afer bankruptcy and foreclosure before one is able to get a new home?

Is it 3 years for foreclosure and 2 years for bankpruptcy?
Is that when you can get a fha loan?