English is not my mother tongue, so i was wondering if you can say "good evening" as a way to say goodbye to somebody because it is, for example, 6h p.m.
In american english, yes, you can use good evening to bid someone farewell.
It sounds a bit formal, but it wouldn't sound incorrect. A punk on a subway might not say it, but a gentleman would.
This works ESPECIALLY well when you are very angry, you can shout it at them and sound very sarcastic as you do not wish them to have a good evening! (same with "good night", "good day", and "good morning")