Timer Sketch Example

I am looking for a simple timer sketch. It should turn-on a relay at 45, 60, or 90 minutes, etc., by changing a variable in the code.
I am guessing that this can be done with millis (but I don't know how to write the sketch myself). I hope to upload the sketch and run two wires to the relay. I'm confident a simple program like it must have been done before.
I have been trying without success to make a countdown timer sketch work which involves a LCD display. It is a nice project, but, for my purpose, the LCD display is unnecessary.
Anyway, I can't get it to work. The problem seems to be with the button circuitry. That's what gave me the idea to eliminate the buttons and LCD, and simply write a variable for the desired time in the code.
A link to the LCD project is copied below. The relay I want to control is shown in the second link. Briefly, it operates at 3–48VDC input, which is perfect for use with an Uno board.

Take a look at File > Examples > 02.Digital > BlinkWithoutDelay and the associated tutorial:

You can set the interval by changing line 42 of the sketch. Remember that's milliseconds so you need to convert minutes to milliseconds (by multiplying minutes by 60 * 1000).

I recommend doing your initial experimentation and testing with an interval shorter than 45 minutes so you don't need to wait forever to see whether it worked.

I changed the 1000 variable to 10000, or 10 seconds. Then, I commented-out the "else" part of the "if" statement (lines 57-66):

if (currentMillis - previousMillis >= interval) {
    // save the last time you blinked the LED
    previousMillis = currentMillis;

    // if the LED is off turn it on and vice-versa:
    if (ledState == LOW) {
      ledState = HIGH;
    //} else {
    //  ledState = LOW;
    }

The LED lights at 10 seconds, and remains high, but this looks like bad code writing.

And, pressing the Uno's reset button initiates a new countdown, but I see three rapid blinks, a very short pause, and then one more split-second blink, before the timing interval starts. What is the purpose of these 4 rapid blinks?

UbuAnon:
this looks like bad code writing.

It's certainly not ideal because the blink code will keep checking if the interval has passed, even though there's no point if you only want to set the pin HIGH once. But it is working code that's non-blocking (doesn't use delay()) so it's a very good start. You can proceed to improve it for your specific application.

UbuAnon:
And, pressing the Uno's reset button initiates a new countdown, but I see three rapid blinks, a very short pause, and then one more split-second blink, before the timing interval starts. What is the purpose of these 4 rapid blinks?

Those blinks are done by the bootloader code that runs after every reset. Their purpose is simply to give you a visual indication that the bootloader is running. Of course it's not desirable to have your relay flicking on and off after every reset. You can simply connect the relay to a different pin, as it's only the LED_BUILTIN pin (typically pin 13) that is blinked by the bootloader. You could also not use the bootloader or replace it with a version that doesn't do the blink but those are more advanced operations so I wouldn't recommend them unless you absolutely have no other choice.