morning/ afternoon/ evening

Hello!
I would really want to know up to what period of time we say Good morning!(from 6 up to 12?),up to what period of time we say Good afternoon and up to what period of time we say Good evening.For example, if it is 12 a. m. do we say Good morning! or Good afternoon?
Thank you for your time!

There is no set, perfectly prescribed period of time.
Good morning starts from the early hours of the day until noon.
Good afternoon starts from noon and can go on into the evening, sometime between 4 and 6 p.m.
Good evening starts from between 4 and 6 p.m. and can last until midnight, though ‘good night’ can also be used in the very late hours.
If it were 12 a.m. then I would say ‘good night’.