Time Of Day

Thread: Time Of Day

1. Junior Member
Join Date
Dec 1969
Posts
16

Time Of Day

I have a statistics page that shows me all sorts of info about visitors to my site. The newest thing that I have made is a list of the time of day that users visit. The problem that I am running into is that when I execute the stored procedure:<BR>"SELECT Stats.IP, Stats.Time FROM TheDate INNER JOIN Stats ON TheDate.ID = Stats.Date_ID ORDER BY Stats.Time;"<BR>And iterate thru the recordset, oddly the 9 o&#039;clock hour (AM & PM) are both empty, which I know can&#039;t be true. Below is a snipit from my big "if then" section:<BR> If (objRSTOD("Time")&#062;"8:00:00") AND (objRSTOD("Time")&#060;"9:00:00") Then<BR> If instrrev(objRSTOD("Time"),"PM")=0 Then<BR> aTime(8)=aTime(8)+1<BR> Else<BR> aTime(20)=aTime(20)+1<BR> End If<BR> End If<BR><BR> If (objRSTOD("Time")&#062;"9:00:00") AND (objRSTOD("Time")&#060;"10:00:00") Then<BR> If instrrev(objRSTOD("Time"),"PM")=0 Then<BR> aTime(9)=aTime(9)+1<BR> Else<BR> aTime(21)=aTime(21)+1<BR> End If<BR> End If<BR>(blah blah blah) If anybody can help me out, I would appreciate it very much.<BR>Thanks in advance,<BR> ~ Orthimnas ~<BR>

2. Senior Member
Join Date
Dec 1969
Posts
11,334

RE: Time Of Day

Maybe try <BR><BR>objRSTOD("Time") &#062;= #8:00:00#<BR><BR>Or CDate() your time...

3. Junior Member
Join Date
Dec 1969
Posts
16

RE: Time Of Day

I tried both ways, no go. I would like to mention that all of the other times are working fine, it is ONLY @ 9 where it chokes.<BR>Thanks again,<BR>~ Orthimnas ~

4. Senior Member
Join Date
Dec 1969
Posts
11,334

RE: Time Of Day

Did you try &#062;= ?<BR><BR>Make sure you put the = in there...

5. Junior Member
Join Date
Dec 1969
Posts
16

RE: Time Of Day

Yep, tried it both ways.

6. Senior Member
Join Date
Dec 1969
Posts
11,247

Erhm -- You have checked you have

Data within those parameters right?

7. Junior Member
Join Date
Dec 1969
Posts
16

RE: Erhm -- You have checked you have

Yes, I have checked the actual information from the DB and there are several hits in the 9 o&#039;clock hours. Wierd eh? If I draw up a SQL query in Access using criteria<BR>&#062;#9:00:00 AM# And &#060;#10:00:00 AM#<BR>It works in access, but when I do roughly the same thing in ASP with an if statement, no go.<BR>The following is my if statment, nothing prints.<BR>sTime=CDate(objRSTOD("Time"))<BR>If sTime&#062;"#9:00:00 AM#" AND sTime&#060;"#10:00:00 AM#" Then<BR> Response.Write sTime<BR>End If

8. Senior Member
Join Date
Dec 1969
Posts
11,334

You're still comparing string

Doing <BR><BR>"#9:00<BR><BR>is just making it a string... you need to do either<BR><BR>&#062;= #9:00:00# &#039;no quotes<BR>or<BR><BR>&#062;= CDate("9:00:00 AM")

9. Junior Member
Join Date
Dec 1969
Posts
16

That did it!

Thank you very much Desert Ghost. I appreciate it more than you know. I am sure you can relate when just one little thing goes wrong and you can&#039;t figure out what the heck it is.<BR>Thanks again,<BR>~ Orthimnas ~

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•