I would say "Good Evening" anytime from dusk until before I go to bed. I would say "good evening" as a hello or "Have a good evening" as a goodbye. I would use "Goodnight" or "Have a goodnight" anytime between from dusk until before I go to bed and only as a goodbye.