M
mike
I am running a program with a conditional statement that
looks at two time/dates in "m/d/yyyy h:mm" format. Both
variables for the time/dates are declared as variant. If I
replace the variables with the actual values obtained from
the Immediate Window, an example looks like this:
(("10/7/2003 22:00") >= ("10/6/2003 16:00")) And
(("10/7/2003 22:00") <= ("10/7/2003 4:00"))
these conditions above are part of an "if" statement and
when the above is entered in the Immediate Window, "true"
is obtained. This doesn't make sense since
(("10/7/2003 22:00") <= ("10/7/2003 4:00")) is not true.
I even simplified it further and entered the following
times in the Immediate Window:
?"22:15">"9:00"
False
?"22:15">"10:00"
True
I don't know what is going on.. thanks in advance
mike
if it helps, my original conditional statement is:
If (((sDate & " " & sTime) >= Format(DateAdd _
("h", -6, Switching(i -
1).TimeSwitch), "m/d/yyyy h:mm")) And ((sDate & " " &
sTime) <= _
Format(DateAdd("h", 6, Switching(i -
1).TimeSwitch), "m/d/yyyy h:mm"))) Then <code>...
looks at two time/dates in "m/d/yyyy h:mm" format. Both
variables for the time/dates are declared as variant. If I
replace the variables with the actual values obtained from
the Immediate Window, an example looks like this:
(("10/7/2003 22:00") >= ("10/6/2003 16:00")) And
(("10/7/2003 22:00") <= ("10/7/2003 4:00"))
these conditions above are part of an "if" statement and
when the above is entered in the Immediate Window, "true"
is obtained. This doesn't make sense since
(("10/7/2003 22:00") <= ("10/7/2003 4:00")) is not true.
I even simplified it further and entered the following
times in the Immediate Window:
?"22:15">"9:00"
False
?"22:15">"10:00"
True
I don't know what is going on.. thanks in advance
mike
if it helps, my original conditional statement is:
If (((sDate & " " & sTime) >= Format(DateAdd _
("h", -6, Switching(i -
1).TimeSwitch), "m/d/yyyy h:mm")) And ((sDate & " " &
sTime) <= _
Format(DateAdd("h", 6, Switching(i -
1).TimeSwitch), "m/d/yyyy h:mm"))) Then <code>...