How add a clock with programmer turn on and turn off lamp

Can I build a remote clock with an alarm programmed to turn lamps on or off?

For example, at night, 7:00 PM turns the light on until 6:00 AM automatically turns off the light.

I use ESP 32 in my app, do you have an idea how to do it?