It is important that you apply for your Schengen visa in advance of your travel. You must apply so that the Embassy has enough time to process your application and produce the visa.
Most Schengen Embassies can process applications within 15 working days, but this can be extended anywhere from 1 to 6 months depending on how complicated the application is. Schengen Embassies will not accept an application more than 3 months before the intended date of travel.
It is therefore recommended that you apply 4-6 weeks before you intend to travel. This will usually mean that they have enough time to issue the visa but please check with the individual Embassy for any delays or their recommendation. Many Embassies will want you to apply in-person but could also want you to start the application process on-line, If you do need to apply in-person, you must arrange an appointment in advance. Please see 'Where do I apply?' for links to the Embassy's website and appointment information.