If you’ve got a 240v water heater that is on a 40A or smaller breaker, this would work: https://www.intermatic.com/Catalog/us/Products/Timer-Control...
If it’s larger than 40A @ 240V, you could buy a 120v astronomical time clock switch and use the output of that as the input to a 120v control coil for a contactor sized for your water heater.