I'm confused about these two sentences, I do not know if 'good evening' is more formal than 'good night'.
They don't even mean the same thing.
"Good evening" is a greeting (like "hello") used when you greet someone in the evening.
Good evening, Alex! I'm excited to see you perform tonight!
"Good night" is a farewell (like "good bye"), said before someone goes to sleep or parts with you at night.
Hope you sleep well. Good night.
Good night is probably the last greeting a person can get in his day. And usually, a 'Good Night' is used during late evenings. Say, it is a late evening party and you're about to leave. You say 'Good Night' to your host rather than a 'Good Evening' as you are most unlikely to see him again for the rest of the day (or night). And when you say 'Good Evening', you tend to consider the fact that nightfall is still due and the day isn't over yet. More significantly, these phrases are based on the time you greet a person. You don't say 'Good Night' to somebody you see at 5 PM, you said 'Good Evening'. On the other hand, when you're off at 8 PM, you could say 'Good Night', which can be substituted by a 'Good Evening' too. There is no hard and fast rule for this. Its all about formality and common courtesy. Both are pretty formal on its own, and neither exceeds the other in its formal degree. Generally, people tend to use 'Good Evening' instead of 'Good Night' during formal conversations, but that doesn't mean 'Good Night' is any less formal.