How to send a message to everyone at a certain in-game time?

That's what daylight sensors are for. These blocks send out a redstone signal that has it's power dependent on what time of the day/night it is.

Daylight sensors come in 2 different types: the regular and the inverted.

For your situation, the inverted type is better to use, as it starts sending out redstone signal during dusk. You simply place the sensor, place a 1 block long redstone wire next to it that powers a command block that sends the message to chat. The syntax of a command that would say in chat "Goodnight" would be:

/tellraw @a {"rawtext":[{"text":"Goodnight"}]}

For hiding the contraption, I suggest using non-opaque blocks. Lava seems to work just fine for this.