Servo timer

I'd use an analog input.

If you want control in discrete steps, you could plug in a resistor (and use a different value for different durations). If you want proportional control over the time, just use a potentiometer.