You will find examples in Using millis() for timing. A beginners guide that do not have problems with rollover to zero