fortypoundhead.com

some ASP Help

Nick asked this question on 5/26/2012. It has been viewed 673 times, and is currently resolved.

Hi, I am going to try and make this as simple as possible, basicly I am trying to make a page, to where if it is a certain time to another certain time, it would redirect to different pages, such as if it was 12:00 AM to 6:00 AM, It would redirect to a Closed page, and if else, it just leave the pages as normal without a redirection.

Thanks.

Keywords:

Answer from dwirch on 5/27/2012

This bit of code should get you a good starting point:

Dim MyHour 'create variable that will store the hour
MyHour=hour(now) 'pass in the date and time to the hour function as a parameter

If MyHour<12 then

   response.write "Good Morning!"

ElseIf MyHour<18 then

   response.write "Good afternoon!"

else

   response.write "Good evening!"

end if


You could also store the result in a variable, such as:Dim MyHour 'create variable that will store the hour
MyHour=hour(now) 'pass in the date and time to the hour function as a parameter

If MyHour<12 then

   MyGreeting="Good Morning!"

ElseIf MyHour<18 then

   MyGreeting="Good afternoon!"

else

   MyGreeting="Good evening!"

end if


Hope this helps!

Reference:Experience



Recent Forum Posts

Malicious IP Checker Companion Tool
dwirch posted on August 12, 2017 at about 20:24 in Site News

Job Spammer: Steve Adams
dwirch posted on August 8, 2017 at about 7:44 in Spammers

New security implemented
dwirch posted on August 8, 2017 at about 6:43 in Site News

New security implemented
dwirch posted on July 23, 2017 at about 6:58 in Site News

Fold Code Manager into main KB?
VB6Boy posted on July 22, 2017 at about 14:42 in Site News

Fold Code Manager into main KB?
dwirch posted on July 22, 2017 at about 14:41 in Site News