Time Function

B

Badass

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!!!

Regards,

Gary.
 
E

Evertjan.

Badass wrote on 15 aug 2006 in microsoft.public.inetserver.asp.general:
Can anyone think of a short piece of code which does he following:

Certainly I can, I am thinking of it now.
Should it be under serverside asp? ASP
-------------------------------------
if Current Time is LESS THAN 19:30 then Write: Open For Business

Else

Write: Sorry - Closed

What have you done sofar yourself?

For help, we would have to no where you go wrong.
 
B

Bob Barrows [MVP]

Badass said:
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
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
%>
 
B

Badass

What have you done sofar yourself?


Not tried it yet, rather than spend 3 hours trying to work it out, I thought
I would check for some help here. I always eventually manage to get things
working on my own if I get no replies, but mostly people are happy to help.

Thanks for the reply.

G.
 
B

Badass

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
%>


Thanks for the reply, will give it a try :eek:)

G.
 
B

Bob Lehmann

Dear lameass,
So, apparently you don't understand the difference between "helping" and
"doing it for you"?

Bob Lehmann
 
B

Badass

Bob Lehmann said:
Dear lameass,

So, apparently you don't understand the difference between "helping" and
"doing it for you"?

Bob Lehmann



Well if someone were to do it for me, it would be a tremendious help!!!
Either way, its helping...

Badass (Apparently Lame).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top