Badass wrote:
Hello,
Can anyone think of a short piece of code which does he following:
-------------------------------------
if Current Time is LESS THAN 19:30 then Write: Open For Business
Else
Write: Sorry - Closed
-------------------------------------
and
-------------------------------------
if Current Time is Between 12:00 and 14:00 then Write: Away to Lunch
Else
Write: Open For Business
-------------------------------------
It's actually for a call centre app, just the above scenario is much
easier to explain. Any help appreciated!!!
This explanation is contradictory, but I think I understand what you mean.
If you wish to write code, you need to learn to clearly state your
requirements. Try it this way:
if time later than 19:30 write "Sorry - Closed"
if time between 12:00 and 14:00 then write "Away to Lunch"
otherwise, write "Open For Business"
Assuming you wish this done in vbscript, then this should do it for you:
<%
dim t
t=now() - date()
't now contains just the current time
if t #19:30# then
Response.Write "Sorry - Closed"
Elseif t >= #12:00# and t <= #14:00# then
Response.Write "Away to Lunch"
Else
Response.Write "Open For Business"
End if
%>
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"