I think that it depends on the type of cold/virus in which you contacted. My dh has a cold and now has the cough , 10 days today for him. I also caught it and today is day 7 for me
Mine started with my back burning,the next day it was aching all over for 2 more days...then 2 days of stuffed up nose and a couple of days with the cough.It is no fun for sure and I am still not up to par...hubby handled his much better then I and he even admits to this lol
Your immune system would play a big role with the " how long" too I would think. If you have had this cough for 3 weeks in all honesty you should make an appointment to go see your dr. just to rule out anything too serious as one never knows.
All the best to you and I sure hope that you are feeling better soon