In terms of how long it takes, realize that there are sort of two direction you can go in:
a) You can learn a lot of dance "steps", or as we call them figures. Your main challenge will be the complexity of the material
b) You can learn fewer figures, but work more on really mastering how they work
Most of the retail-style studios both for private lessons and groups (and even most group classes in other settings) concentrate on the first method - presenting lots of material. That's because it's fairly easy to teach steps, it's easy to measure progress ("well, he learn steps 10-15 from the syllabus this month") and it's easy to train teachers in this material - for someone with moderate command of their body, it's mostly about memorization.
The other approach - quality over quantity - is less marketed to the public, but it ends up matching the personal work habits of any dancer who makes a real career of it. Sure, a top amateur or professional competitor might know countless figures, but most of their effort is on the quality of execution. In terms of mastering that, there are really only maybe a dozen major sorts of body actions per dance style that consume most of their attention - the diversity of figures is just a bunch of clever ways to combine those and slap a convenient name on the result. They spend months, then years on these key concepts, and rarely need to put more than a short burst of effort here or there into memorizing the steps.
Which path is right for you depends on things like what sort of training is available, your budget, your goals - and most importantly, what appeals to you personally. If you like memorizing material, then you can learn a lot of variety. If you like understanding and striving for quality of movement, then try to focus only on the basics for the first year or two - but make sure you have a teacher who really knows them inside and out (anyone who tries to talk you out of that, or uses the "boring" word clearly does not).
You asked about dancing at events in society outside of the dance world. Mostly you will get to use your basics, though in some dances - swing, salsa, etc, if you are the leader you may find that there are a lot of variety figures you can use that don't really challenge a follower you are dancing with. Unfortunately, a lot of the other material you will learn really will only work with someone who is at least "ready for it" in that their body is comfortable with the constituent motions. And sadly, a lot of what gets taught in classes is just not very good material - it does not flow logically from one position to another and as a result it may *only* work with someone who was in the same class as you.
The real question to always keep in mind is: am I learning to dance? Or am I learning to pay for lessons?
Additionally, while lessons from a good teacher are an important component, if you really want to master dancing you will need experience dancing outside of classes with one or more of your peers. This can also help you increase your dance time - dancing several days a week will be much more effective than just one or two. It's one thing to be able to do something with a teacher, another to do it with a friend (and best of all when it flows nicely with someone you never met before!) Ideally your outside practice between classes would be enough to get to feel like you have tried to apply what you learned, but not so much that you start to mistrust your memory (or worse, your partner's opinion!) of how it was taught in class.
The conclusion from all of this, is that how long it takes depends on what you want to do, and if what you end up doing is an effective route to your goals. If you concentrated on the minimum number of steps to have something you could do for each of a half dozen major dances, and practiced those regularly with peers outside of class, then in maybe 12 weeks (encompassing maybe 24 group or private lessons, and 36 hours of peer practice) you should be able to feel like dancing is something you can really do with some earned confidence. (though you will of course be hyper aware of many ways in which you want to improve) On the other hand, if you only dance in lessons and always feel like you are struggling to catch up with the pace of presentation, you could take hundreds of lessons and not really end up with the confidence to do anything.