The duration of German language courses varies, so that you're certain to find one that suits your requirements. Intensive courses may last for a week or several weeks, other courses may take a whole semester. Depending on the type of course, you will spend several hours per week or even per day in class or on homework. If you work during the day, you may choose an evening course. Alternatively, you can visit Germany on holiday and do a language course then.
You also need to think about whether you prefer to study alone or with others. Learning in a group is usually cheaper and it means you can talk to your fellow students. Individual classes are often more expensive but tailored to your individual requirements and more flexible regarding the schedule of your classes.
Prices for language courses depend on the type of course and the country where you want to study. Your best bet is to contact language centres directly and inquire about the cost. If you're moving to Germany because of work, you can ask your employer whether they're prepared to pay for your course.
Most language courses end with an exam which you need to pass before you can move on to the next level. You're well advised to find out beforehand whether the exam is included in the course fee.