You need to give notice. It will be in your lease. It's usually 30 days. Anything less than that and you'll have to pay rent regardless.