The headline is a valid question and it concerns, literally, 99% of the people who learn to play guitar, but maybe this is not the right question to be asking. Let me give you a different point of view with a simple example, to better illustrate what I mean:
Suppose you have been playing guitar for a few years and you are sending me this question:
"How long will it take me to learn 'For the love of God' by Steve Vai?"
Let me clarify, that this is a random example. Thankfully, nobody asked me this specific question but we will take this as an example. A hypothetical answer I would give is: "Judging from your playing if you are playing for two hours per day, it should take you about six months." Let us say that you are taking my words as gospel and you are starting practicing two hours per day for six months, and you have not mastered the song. What happens now?
You start feeling bad for yourself, maybe that you are less talented, and you should waste no more time with the guitar because you just "do not have it". In several cases, people will quit playing the guitar! The problem here is that people set an arbitrary expectation and then when they are not meeting this expectation, they feel bad for themselves and this leads to an emotional downward spiral. I have, personally, witnessed people giving up and just selling their guitar gear because they failed to reach their self-imposed, totally arbitrary deadline for something!
This is why, even though my actual JOB is to answer guitar-related questions, I try NOT to answer this specific one. And if I happen to answer it, I always put a lot of disclaimers around my response. The reason for that is that there is no good scenario. If you reach your goals in six months then you have just reached what you are going to reach anyway. If you do not, then it is going to feel like a massive loss, which can seriously dishearten you.
First things first, it is important to realize that this is not an optimum mindset. The main reason for that is that it can be used ONLY for one thing, and this is quitting something you love (in this case the guitar)! There is a much better, lifelong mindset you can use - and that is to put good conditions in your life that will help you towards becoming a better guitar player, and a happier guitar player. To give you some examples of what a good condition means: getting a guitar coach to help you with a really good quality feedback on your playing, and having weekly jam sessions with your friends. Then, having a goal in which you will aim to do in a specific amount of time but you are not going to be pressured to do it. Just enjoy the process and the results will come. It does not need to come at a specific, random, arbitrary point in time.
Once you are already advanced and there is no way you are going to give up on the guitar, then you can put specific deadlines on your goals. Back in the day I used to release one big project per year - like one CD or one instructional book. However, by that stage in my career, there was no chance of me quitting or even getting seriously upset because I missed a deadline. The deadline was used constructively. For a beginner/intermediate, most deadlines can only be used destructively because negative thoughts about yourself occur way more than you think. So, should you use deadlines? Yes, but only if you have the proper mindset.
The only thing that you should really worry about is turning some positive processes into habits. Once you follow these habits, you will reach the goals that you have set.
I hope this was helpful. You can watch the video below, where I explain this topic in more detail. If you're interested in developing your guitar skills and reaching your music goals, please check the different Elite Guitar Coaching Academy packages and how you can get private coaching from me.