Depends on what your signed rental contract says, never mind that the guy agreed with you. Usual is 3 months' notice given by registered letter and also usually tied to specific moving dates which are canton specific.
Here in Fribourg the dates are 31st March, 30th June and 30th September. So if I wanted to move out on the 30th September I would need to send a registered letter to reach the agency/landlord no later than 30th June to give the 3 months' notice.
The other possibility is for you to give the required notice, but find another tenant to take over your lease so you could move out before the notice date. Otherwise, you're liable for the outstanding rent.
https://www.ch.ch/en/terminating-rental-agreement/