There is an anecdote about a prospective student seeking to study swordsmanship with Tsukahara Bokuden:
On their initial interview, Matajuro asked Tsukahara Bokuden, "How long will it take me to master the sword?" Bokuden replied, "Oh, about five years if you train very hard."
"If I train twice as hard, how long will it take?" inquired Matajuro. "In that case, ten years," retorted Bokuden.
as told by Kensho Furuya (1996).
The question of how long it takes to learn swordsmanship (irrespective of the actual weapon used) is a rather open question, since there is the question of "to what level of ability?"
The basic core techniques can be taught in a few hours. Holding the weapon, the basic stances (e.g., middle, low, and high guards, and hanging guard), stepping, cuts, and thrusts can all be taught within a two hour lesson. The basics of defence - blocks and parries - can also be taught, but typical students will be unable to properly use them under any pressure.
After perhaps 5-10 such lessons, the student will be more fluent in the techniques, and should be able to execute attacks with reasonable technique in sparring. Their defence will probably still be poor, with blocks and parries started late and moving too far with too much commitment, easily fooled by feints. Students should be building their judgment of distance and time.
With about 100 hours of training, the student will cope better with an opponent. Students should be getting better at body mechanics for power generation, block/parries should start being efficient and effective, and the student should be building their ability to read an opponent. Judgment of distance and time should be acceptable. They should be capable of sparring at speed. It is at this point that Olympic-style fencers and kendoka are often ready to compete in low-level competitions (note: compete in, but not likely to win).
With about 1000 hours of effective training, students should be good. Note that 1000 hours is about 3 years, training about 6 hours per week (which isn't very intensive training, but is more than many modern students of swordsmanship train). This is more training than most modern martial arts usually require for a black belt (a typical black belt level would lie somewhere between this level of training and the previous one, depending on the martial art and school; except for BJJ which typically has much higher black belt standards and perhaps about 2000 hours of training might be average to reach black belt).
The last level above is still not mastery! Some students - many students, even - won't progress beyond this point. It's difficult to be usefully precise about the time needed to achieve mastery. While 10,000 hours is often quoted as the training time required for mastery, it is important to note that it needs to be effective and meaningful training, and not just going through the motions. Note that top-level fencers typically have 10 years or more of experience, and train hard with good coaches. Even at this point, they can continue learning.
Reference:
Kensho Furuya, Kodo: Ancient Ways, Black Belt Communications, 1996