There is no “shortest time” from an energy-saving POV, only from a nuisance or convenience POV. The physics is straight-forward:
You’re paying for energy to heat all the water that you use, plus the heat you waste up the chimney if you’re burning fuel. Plus you’re paying for all the “standby” or “tank loss” energy that moves through the tank wall into the surrounding space, plus the heat you waste up the chimney if you’re burning fuel. If you’re also heating the house (basement), you’ll get some savings from the tank loss, though usually not 100%. If you’re cooling the house (basement), you’ll get some additional costs from running the AC to pump the extra heat out of the house.
Since you’re not using any hot water while you’re away, it’s obviously all about “standby” or “tank loss” energy. The rate of energy loss through the tank wall is a direct function of the “delta T”, i.e., the difference in the temperatures of the hot water inside and the air outside. Every day, hour minute, second. . . you let the water temperature drop closer to the air temperature, it loses less energy and you save energy and money. Sure, it takes energy to reheat the water, but the total energy loss is dropped by the temporary turn-down.
The only minor wild-card here is that the energy efficiency of most water heaters isn’t constant, but is affected by changes in tank temperature, length of “burn”, etc.. But I’m pretty sure the net direction of those changes is to add a bit to the savings, so it’s even more worthwhile to turn it off (or down) whenever it’s convenient.
Norm in Toronto