i need to correct them this sentences

4. Irony is when you expect one thing and get something else.
5. By turning off the water when you brush your teeth, you can save up to eight gallons of water per day.

Is "irony" a time? Why is "when" there?

#5 looks fine to me.