By "How long" I'm assuming from the time they actually start trying to actively publish to the time they finally get published. For example, I've been writing since I was 10 years old - but if I ever (finally) publish a book one of these days, I'm certainly not going to tell people that it took me 20 years.
I realize that the time frames will also vary, but I am wondering if there are any general patterns. I've known far too many people who have churned out a book in six months and expected to become a famous, published author right away. I don't expect that - I've been trying for three years. But it can become discouraging sometimes.
I'm not interested in self-publishing, by the way. This is a question specifically addressing the 'traditional' publishing industry.
I would especially be interested in hearing from people who have actually gotten a book published - how long it took them to get to that point.
EDIT: Edited the title question for clarity's sake.