For me, the first time took several months.
Getting back to sub 20 a second time took 9 years and the right pair of shoes.
The story:
In my senior year of high school, I ran cross country and track. Basically, a friend asked me if i wanted to join and i said ok. Cross-Country was a struggle as my best time all season was a 22:02 for a 5k. But, knowing i wanted to do track, i trained all winter.
That early Spring, I was able to get a 19:56 at the Carlsbad 5000. Since we were the last race before the elites went, it was late enough in the morning where i felt ideal for that kind of a run.
In Spring of my senior year of college, I did a 5k put on by UCSB recreation. I thought maybe i could break 20 there, but I came 5 seconds short of that.
After that, I was more interested in basketball and so i hadn't done any distance running in favor of hours of basketball during the week.
In 2006, a friend and i were in Carlsbad and i saw people running and remembered that the Carlsbad 5000 was the next day. I decided to run it without having trained for 5k for a long time.
My time of 24:39 was pedestrian, but it piqued my interest about what i could do it with better training.
Since then, I had done races of different lengths. Two months before the 2015 Carlsbad 5000, I had seen this pair of Avia shoes that were on sale for $11. While breaking them in, I realized how comfortable and light the ride was. As a result, in my first 5k of 4 in rhe "All-day 20k" event , I was able to get a 19:35 at the age of 41.
To me, the difference between my 24:39 and my 19:35 was feel. People say it's fitness, weight ratio, mileage, etc. And while they do play a part, how you feel that day could result in a time above 20 even if you're in sub 20 shape.
The 5k i felt the best before where i thought even 19 would go down, I got a 22:08 because the shoes i had just didn't feel right that day even though i liked them while breaking them in.
This how you feel is a lot of why runners may "bonk" unexpectedly.
As many on letsrun do, by relegating times purely to fitness and weight shows that you may understand what your coach told you, but you may not understand the vast realm outside of your coach or buddies