How to Make LDR and PIR sensor response Time?

Hello everyone.
I looking for the solution about my small project.

So I decided to make motion and light sensor using PIR sensor and LDR.
I have the code which work perfectly. Here is it

#define LDR 0
#define PIR 2
#define LED 3

int pirState;
int ldrValue;

void setup() {
  //Serial.begin(9600);
  pinMode(LED, OUTPUT);
  pinMode(PIR, INPUT);
  digitalWrite(LED, LOW);
}

void loop(){
  ldrValue = analogRead(LDR);
  //Serial.print("Analog reading = ");
  //Serial.println(ldrValue);

  if (ldrValue <= 512) { // dark
    digitalWrite(LED, HIGH);
  } 
  else { // ldrValue > 512
    pirState = digitalRead(PIR);
    if (pirState == HIGH) {
      digitalWrite(LED, HIGH);
      delay(5000);
      digitalWrite(LED, LOW);
      delay(1000);
    } 
    else { // pirState == LOW
      digitalWrite(LED, LOW);
    }
  }
  delay(1000);
}

my question is, how to make :
LED OFF when time is (example) 10pm - 3am but ON when there is a motion

You need to use an RTC module for keeping time, google for "arduino RTC module", you'll find a lot!

Cheers, ALe.

Hi, RTC info and how-to and code HERE:

ilguargua:
You need to use an RTC module for keeping time, google for "arduino RTC module", you'll find a lot!

Cheers, ALe.

terryking228:
Hi, RTC info and how-to and code HERE:

Thanks for respond.
But how to do it without RTC?

and

How is the code if I use RTC?