Student or Learner
If I have said to my friend
Goodnight at evening and I mean by that have a nice night.
Is it correct? Or good night is a farewell word as same as goodbye.
We use "goodnight" as a farewell when we leave people at the end of an evening to go home, and also to indicate that we are leaving the room to go to bed. In that regard, it's like "goodbye". When used in this way, it's all one word.
You can say "Have a good night" in the same way as "Have a good evening" but only if you know that the person you're speaking to is going somewhere special or doing something different later on than the evening. If they're going to the cinema at 8pm and will be home by 10.30pm, I'd say "Have a good/nice evening". If they were going out for dinner at 9pm and then going to a nightclub/disco/casino at midnight and probably staying out until 4am, I would say "Have a good night". Used like this, it's two words.