Click to See Complete Forum and Search --> : [RESOLVED] test hour of day against set hour, if smaller, display, else do not


bradkenyon
09-11-2008, 10:38 AM
I want to only display a certain message between the time of 8am and 6pm

So it would look something like this, I am not very familiar w/ ASP, so I Imagine I have to do something w/ NOW() and extract the hour from that.

if NOW() >= 8 && NOW() <= 18 then
Response.Write "Before 6pm"
endif

bradkenyon
09-11-2008, 11:01 AM
if Hour(Now()) <= 18 And Hour(Now()) >= 8 then
Response.Write "success"
end if

Bullschmidt
09-15-2008, 07:30 PM
And you might want to look into the DateDiff() function.

Visual Basic Scripting Edition Functions
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/adaabd2b-250e-4040-9eaa-127f5a41f8b9.asp