I have a VBscript that query the database to pull data that is base on the shift EG. graveyard, day, and swing. I need to adjust the time by an hour less only on days that are past 1-6-2019. I am new to programming and need help with my logic.
The solution I have tried is expanding my if statement and adding an AND function but It wont work because the first if statement is still true.
dim intCoilCount, intTotalSeconds,intSeconds,strDate,strShift
'SQL="select timeStamp, coil_number, entry_gaptime,thickness,width_in,grade from TABLEEEE by timeStamp"
strShift=Request.Form("SHIFT")
strDate=Request.Form("StartDate")
'if date is greater than 2-22-2006 (switchover date) use SCALEFACTOR
'-----start-----------------
if datediff("d",strDate,cdate("2/22/2006")) <= 0 then
SCALEFACTOR=30000.0 / 50.0
else
SCALEFACTOR=1
end if
'-----end-----------------
'Fixed scale factor problem
'-----start-----------------
SCALEFACTOR=1
'-----end-----------------
SQL="select timeStamp, coil_number, entry_gaptime,thickness,width_in,grade from entryCoilData"
if strShift="graveyard" then
SQL = SQL & " where timestamp > '" & cdate(strDate)-1 & " " & "11:00PM" & "'" & _
" and timestamp <= '" & strDate & " " & "7:00AM" & "'"
elseif strShift="graveyard" and strDate >= cdate(1-6-2019) then
SQL = SQL & " where timestamp > '" & strDate & " " & "10:00AM" & "'" & _
" and timestamp <= '" & strDate & " " & "2:00PM" & "'"
elseif strShift="day" then
SQL = SQL & " where timestamp > '" & strDate & " " & "7:00AM" & "'" & _
" and timestamp <= '" & strDate & " " & "3:00PM" & "'"
elseif strShift="day" and strDate >= cdate(1-6-2019) then
SQL = SQL & " where timestamp > '" & strDate & " " & "7:00AM" & "'" & _
" and timestamp <= '" & strDate & " " & "3:00PM" & "'"
else
SQL = SQL & " where timestamp > '" & strDate & " " & "3:00PM" & "'" & _
" and timestamp <= '" & strDate & " " & "11:00PM" & "'"
end if