Click to See Complete Forum and Search --> : How would YOU do this? *RESOLVED*
HollywoodKY
Mar 8th, 2004, 11:12 AM
I would like to have a page that loads different data from a database based solely on what time of day it is. For instance, if it's between 11:00 AM and 1:00 PM, then DO THIS. Does anyone have any links or suggestions on working with time in ASP or ASP.Net? Thanks!
HWOODKY
:)
hellswraith
Mar 8th, 2004, 05:08 PM
in your query do this:
WHERE MyDateTime BETWEEN(FirstDateTime, LastDateTime)
or something to that affect.
HollywoodKY
Mar 8th, 2004, 09:39 PM
Actually, I'm wanting it to use the system time to determine what the page should display. If its between 12:00PM and 4:00PM, then display "this" page. The problem I'm running into is comparing the times and formulating an IF THEN statement. It would basically look like this:
On Page Load
If "System Time" > 11:59 AM AND < 4:01 PM Then
Load SampleSub
ElseIf "SystemTime" >4:00 PM AND < 10:01 PM Then
Load SampleSub2
End If
I'm pretty clueless as to how to formulate that statement... any ideas?
HWOODKY
:)
Fishcake
Mar 9th, 2004, 06:55 AM
IF now.hour >= 0 AND now.hour < 16 THEN
Load SampleSub
ELSEIF now.hour >= 16 AND now.hour < 22 THEN
Load SampleSub2
END IFIs that what you need?
Now.minute, now.second,now.millisecond (and pretty much any other measure of time really) are also available if you need to narrow it down further. All return integer values.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.