led blink

i want to blink an led in pin3,while any one this condiction is true:

  1. the LDR output is below 500
    2.the time is between 4-5
    i have written a code but it is not blink between 4and5. even-though it blinks when the sensor value below 500
    my code is given below:
    #include <Time.h>
    void setup()
    {
    Serial.begin(9600);
    pinMode(3, OUTPUT);

}
void loop()
{
int t;
t = hour();

int sensorValue = analogRead(A0);
if ((sensorValue<500)||(4<=t<=10))
{
digitalWrite(3, HIGH);
}
else {
digitalWrite(3, LOW);
}
}
my output is led is on for all the time

You can't do this:

(4<=t<=10)

4<=t evaluates to either true or false, then you comparing true or false with 10. Wrong.

int t;
 t = hour();

As opposed to?

int t = hour();

Why?

if ((sensorValue<500)||(4<=t<=10))

If t is greater than 4, the result will be true. True is less than 10.

That is NOT how to test for a value in a range. There are NO shortcuts.

if ((sensorValue < 500) || (t >= 4 && t <= 10))

It makes no damned sense to me to put a space after if and then jam everything else together. Use white space to improve the readability of your code.

Use Tools + Auto Format, too.

why? #aarg..
then how can i give that statement to blink led when (t=4,5,6,7,8,9and10)

toniihrd:
why? #aarg..
then how can i give that statement to blink led when (t=4,5,6,7,8,9and10)

@PaulS told you.