The law stipulates a notice period for dismissals or terminations of 4 weeks to the 15th or the end of a calendar month. Unless your employment contract or collective agreement stipulates otherwise, this also applies to you. You receive your written dismissal. The deadline period starts one day later.
Please note: if you work for a company for a longer period of time, the statutory notice period is extended for the employer's notice of dismissal, but not for your own notice of termination.
Your employment contract or collective agreement contains the rules on termination/dismissal. There are exceptional cases in which the deadlines are shorter, for example during the probationary period (then the deadline is usually only two weeks).