Deadlines for visa applications
The deadlines for applications vary according to visa. For a tourist visa, and most others, there are no deadlines; you should just allow sufficient time to get the visa to suit your plans. Contact the Japanese Consulate for details - they will be able to tell you roughly how long it takes someone from your country to get that visa for Japan or if you can get it on arrival in Japan.
The only visas that do have deadlines are student visas. These are issued to coincide with the start dates of the school courses or the university year. Ryugaku visas are issued from April and September; you should apply through a university according to their guidelines. In general, applications will close at least six months before the start of the visa. You should start planning 9 to 12 months before your intended start so that you don't miss out on the visa. Japanese university courses start from April on the whole, so you will probably have to take the visa from then if considering university study.
For the Shugaku visa, which is issued from January, April, July and October, you should check with the school through which you are applying. In general, applications will close 3 months before the start of the visa - but it will vary from school to school. Some will fill their quota early; others will have a good relationship with the immigration office and be able to submit late applications up to two months before the start of the course. It depends on the school, so again, you have to contact them. However, begin your planning six months before the intended start date so that you don't miss out on a place. Also note that in the case of the Shugaku visa, not all schools offer all start dates - some only offer April and October starts.
Deadlines do not apply when changing visa status from another visa. In such cases, you should begin the changeover before the end of your existing visa.