I mostly agree with Adam, except that I don't think you need to wait until 6:00 am to say "good morning." If your job starts at 4:00 am, it's normal to say "good morning" to your co-workers at that time. (There's a coffee shop near my house that opens at 4:30 am, and the people who work there always say "good morning" to customers.)
The only really strict rule about these greetings is that after 12:00 noon, it's not morning anymore. So you can't say "good morning" at 1:00 pm. You have to say "good afternoon." There's no strict rule about when "afternoon" ends. We usually start saying "good evening" once the sky starts to get dark, but that could happen at a different time depending on where you live and whether it's winter or summer. After midnight, the time could be regarded as "night" (if you're still awake from the day before, or if you're asleep) or as "morning" (if you recently woke up).