It is advisable to apply for it at least two weeks prior to the planned trip. The Embassy Consulate generally replies within 10 working days.