Pass ac current for specific amount of time

How to pass ac current as output for certain sepcific amount of time?
I wanted to code my Arduino such that no. of seconds will be stored in a variable(which shouldn't be reset if Arduino is turned off) and it will give ac current as output for that amount of time.

Look at how you can save values in EEPROM that can be read after power off or a reset

As to timing, take a look at Using millis() for timing. A beginners guide, Several things at the same time and the BlinkWithoutDelay example in the IDE