Getting info from database -between dates
I am trying to get infro between two dates and time.
It starts from 5:00:00 PM yesterday to today 5:00:00 AM.
I tried code blow but it did not worked.
<%
tstart="5:00:00 AM"
tend="5:00:00 PM"
yesterday = CDate(DateAdd("d" , -1, Date()) & " " & tstart)
today = CDate(Date & " " & tend)
Set baglanti=Server.CreateObject("ADODB.connection" )
baglanti.Open "driver={microsoft access driver (*.mdb)}; DBQ=" &Server.MapPath("db.mdb" )
SQL="select * from CallList Where Customer='"& customerid &"' AND RequestedDate BETWEEN #" & yesterday & "# AND #" & today & "# AND [Requested Time] BETWEEN #" & tstart &" # AND #" & tend &"# order by CAD asc"
Set kayitseti = baglanti.Execute(SQL)
%>
|