* -(으)면 means 'if' and -(을)때 means 'when'
Here are sample sentences.
1. -(으)면
e.g. 날씨가 좋으면 산책할 거예요. (I will take a walk if the weather is good.)
저는 커피를 마시면 잠을 못 자요. (I cannot sleep if I drink coffee.)
시간이 없으면 나중에 해도 돼요. (You can do it later if you don't have time.)
2. -(을)때
e.g. 시간이 있을 때 뭐 해요? (What do you do when you have time?)
저는 화가 날 때 운동을 해요. (I do exercise when I get angry.)
도서관에 갈 때 학생증을 가져가세요. (Please bring a student card when you go to a library.)