You must apply for the visa within six months from the date that you receive your CAS. However, you can apply for the visa at any time up to six months before the course start date on your CAS (if you are applying from outside the UK).
You will typically receive a decision from the Home Office on your visa within three weeks from the date of your application if you are applying from outside the UK.