some ASP Help

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

Disapprove Delete

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

Disapprove Delete

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


Code Links