(2) You have to notify the landlord at lease 30 days before move out. And It must be a FUll month's First day. For example,
Correct: Notify him at Mar 1st that you will move out on April 1st.
Wrong, Notify him at Mar 15th that you will move out on April 15th. This is not a Full Month.
(3) You have to notify him by writing. say, If you only spoke to him about the moving out, and then he rent the place to next tenant, then you said you changed your mind --- you will stay. In the worst case, he might have to pay hotel fee for the next tenant.
(4) If you fail to do (1)(2)(3), the landlord can use your deposit to cover his one-monthrent loss.
Usually, when a landlord charge some money, he has a good legal ground. Because he doing this for business and he must have read all related documents. Usually, it is the tenant does not know the rules. A good landlord will remind a new tenant of certain rules before move-in, but not all of them are so good. It is tenant's own responsibility to read related documents and protect his/her own interests.
For now, the best solution is not argue with landlord. Because of your late notification, he might suffer some rent loss. Be co-operative, ask the landlord ASAP, what you can help to minimize the loss. If there is no rent loss, the landlord could not deduct your deposit (providing you cleaned your place well).
If he still refuse to give deposit back to you, let go. You won't win anywhere. Learn from this lesson, and reading local Rental Act and lease contract carefully next time.