timed dpdt relay fesability

can't i use a time library and set programs for alarms? then program the alarm code for digital output and duration to transistor?