millis fonction

Look at the blink without delay example sketch. If you record the value of millis() at the start of an interval, you can subtract that from the value of millis() taken later on to work out how much time has elapsed since the start of the interval.