how do i replace delay with millis in this code

The ServoTimer2 library write() function takes microseconds in the range 0 to 2000 as its position paramater unlike the Servo library write function that takes degrees from 0 to 180

Hence the ServoTimer2 write() function is equivalent to the Servo library writeMicroseconds() function