This will partly depend on where you apply for your visa. You can visit the Home Office Visas and Immigration website's Visa Processing Times page https://www.gov.uk/guidance/visa-decision-waiting-times-applications-inside-the-uk  to give you an indication of visa processing times in your country. As it is a complicated process, it advisable to start applying for it as soon as possible.