An employee has to observe the laws concerning cancelling a working contract as well. The time you need to cancel your contract in advance of the date you want to leave depend on your specific contract, the collective agreement and the law. There is for example the regulation, that an employee may cancel his or her contract four weeks before the 15th of a month or the end of a month. There is no shorter period of time possible, but your contract may set a longer period. Your period can only be longer than four weeks if the employer has to respect that period if he or she wants to cancel your contract as well.
For further information see: