469,963 Members | 1,309 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,963 developers. It's quick & easy.

Time Function

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.
Aug 15 '06 #1
6 1256
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
-------------------------------------
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!!!
What have you done sofar yourself?

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

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 15 '06 #2
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"
Aug 15 '06 #3
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.
Aug 15 '06 #4
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 :o)

G.
Aug 15 '06 #5
Dear lameass,
>but mostly people are happy to help.
So, apparently you don't understand the difference between "helping" and
"doing it for you"?

Bob Lehmann

"Badass" <ba****@spamspam.comwrote in message
news:qO*****************@text.news.blueyonder.co.u k...
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.


Aug 16 '06 #6

"Bob Lehmann" <no****@dontbotherme.zzzwrote in message
news:O3**************@TK2MSFTNGP04.phx.gbl...
Dear lameass,
>>but mostly people are happy to help.
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).
Aug 18 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by androtech | last post: by
6 posts views Thread by David Graham | last post: by
17 posts views Thread by newbiecpp | last post: by
17 posts views Thread by Razzel | last post: by
5 posts views Thread by Sinan Nalkaya | last post: by
3 posts views Thread by cj | last post: by
9 posts views Thread by Ron Adam | last post: by
1 post views Thread by nigelesquire | last post: by
1 post views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.