How to use millis() for simultaneous switches

I have a program where when 4 pairs of wires are hooked up in the correct way 2 switches become active. When the 2 switches are turned on within 1 second of each other 2 lights stay on until a switch is turned off. If only one switch is turned on then only one light(according to which switch) turns on for 2 second then turns off. I have been told to use millis(), but I have never used millis and am not sure how it works. Here is my code if anyone can help that will be great, thanks.

int wire1 = 2;
int wire2 = 3;
int wire3 = 4;
int wire4 = 5;
int wire5 = 6;
int wire6 = 7;
int wire7 = 8;
int wire8 = 9;
int wire9 = 10;
int wire10 = 11;
int wire11 = 12;
int wire12 = 13;
int wireS1_1 = 16;
int wireS1_2 = 17;
int wireS2_1 = 18;
int wireS2_2 = 19;

int pair1 = 0;
int pair2 = 0;
int pair3 = 0;
int pair4 = 0;
int pair5 = 0;
int pair6 = 0;
int pairS1 = 0;
int pairS2 = 0;

int relay1 = 14;
int relay2 = 15;

int switchstate = 0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  
  pinMode(wire1, INPUT_PULLUP);
  pinMode(wire2, INPUT_PULLUP);
  pinMode(wire3, INPUT_PULLUP);
  pinMode(wire4, INPUT_PULLUP);
  pinMode(wire5, INPUT_PULLUP);
  pinMode(wire6, INPUT_PULLUP);
  pinMode(wire7, INPUT_PULLUP);
  pinMode(wire8, INPUT_PULLUP);
  pinMode(wire9, INPUT_PULLUP);
  pinMode(wire10, INPUT_PULLUP);
  pinMode(wire11, INPUT_PULLUP);
  pinMode(wire12, INPUT_PULLUP);
  pinMode(wireS1_1, INPUT_PULLUP);
  pinMode(wireS1_2, INPUT_PULLUP);
  pinMode(wireS2_1, INPUT_PULLUP);
  pinMode(wireS2_2, INPUT_PULLUP);

  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);
  digitalWrite(relay1, HIGH);
  digitalWrite(relay2, HIGH);
}

void loop() {
  // put your main code here, to run repeatedly:
  
  pinMode(wire1, OUTPUT);
  digitalWrite(wire1, LOW);
  
  if(digitalRead(wire5) == LOW)
  {
    pair1 = 1;
    pinMode(wire1, INPUT_PULLUP);

    pinMode(wire2, OUTPUT);
    digitalWrite(wire2, LOW);
    
    if(digitalRead(wire6) == LOW)
    {
      pair2 = 1;
      pinMode(wire2, INPUT_PULLUP);
      
      pinMode(wire3, OUTPUT);
      digitalWrite(wire3, LOW);

      if(digitalRead(wire7) == LOW)
      {
        pair3 = 1;
        pinMode(wire3, INPUT_PULLUP);
        
        pinMode(wire4, OUTPUT);
        digitalWrite(wire4, LOW);
        if(digitalRead(wire8) == LOW)
        {
          pair4 = 1;
          pinMode(wire4, INPUT_PULLUP);
        }
             else
  {
    pair1 = 0;
    pair2 = 0;
    pair3 = 0;
    pair4 = 0;
  }
      }
           else
  {
    pair1 = 0;
    pair2 = 0;
    pair3 = 0;
    pair4 = 0;
  }
    }
     else
  {
    pair1 = 0;
    pair2 = 0;
    pair3 = 0;
    pair4 = 0;
  }
  }
       else
  {
    pair1 = 0;
    pair2 = 0;
    pair3 = 0;
    pair4 = 0;
  }
            pinMode(wireS1_1, OUTPUT);
          digitalWrite(wireS1_1, LOW);

          pinMode(wireS2_1, OUTPUT);
          digitalWrite(wireS2_1, LOW);
          

        if(pair1 == 1 and pair2 == 1 and pair3 == 1 and pair4 == 1)
        {
          if(digitalRead(wireS1_2) == LOW or digitalRead(wireS2_2) == LOW)
          {
            delay(1000);
            while(switchTime<1000)
            {
             if(digitalRead(wireS1_2) == LOW and digitalRead(wireS2_2) == LOW)
             {
               switchstate = 3;
             }
             else if(digitalRead(wireS1_2) == LOW)
             {
              switchstate = 2;
             }
             else if(digitalRead(wireS2_2) == LOW)
             {
              switchstate = 1;
             }
             else
             {
              switchstate = 0;
             }
          }
            if(switchTime >= 1000)
            {
              switchTime=0;
              break;
            }
          }
             switch(switchstate){
              delay(1000);
              case 0: 
                digitalWrite(relay1, LOW);
                digitalWrite(relay2, LOW);
                break;
              case 1:
                digitalWrite(relay2, HIGH);
                digitalWrite(relay1, LOW);
              case 2:
                digitalWrite(relay1, HIGH);
                digitalWrite(relay2, LOW);

              case 3:
                digitalWrite(relay1,HIGH);
                digitalWrite(relay2,HIGH);
             }
        }  
}

Have a look at Blink Without Delay. If you've gotten as far as you have on your own, you shouldn't have much trouble figuring it out. Fairly simple really.

DangerToMyself:
If you've gotten as far as you have on your own, you shouldn't have much trouble figuring it out.

I would learn how to use arrays and for loops first and simplify that turgid code it is much longer that it need be.

That code is quite unreadable indeed. Too much repetition, too little comments, totally non-descriptive variable names.

The demo Several Things at a Time is an extended example of BWoD and illustrates the use of millis() to manage timing without blocking. It may help with understanding the technique.

...R