Time Function

Discussion in 'ASP General' started by Badass, Aug 15, 2006.

  1. Badass

    Badass Guest

    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.
     
    Badass, Aug 15, 2006
    #1
    1. Advertising

  2. Badass

    Evertjan. Guest

    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)
     
    Evertjan., Aug 15, 2006
    #2
    1. Advertising

  3. 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"
     
    Bob Barrows [MVP], Aug 15, 2006
    #3
  4. Badass

    Badass Guest

    > 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.
     
    Badass, Aug 16, 2006
    #4
  5. Badass

    Badass Guest

    > 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.
     
    Badass, Aug 16, 2006
    #5
  6. Badass

    Bob Lehmann Guest

    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" <> wrote in message
    news:qOsEg.4082$...
    > > 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.
    >
    >
     
    Bob Lehmann, Aug 16, 2006
    #6
  7. Badass

    Badass Guest

    "Bob Lehmann" <> wrote in message
    news:...
    > 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).
     
    Badass, Aug 18, 2006
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. engsol
    Replies:
    2
    Views:
    980
    Dan Bishop
    Jan 26, 2004
  2. Replies:
    8
    Views:
    494
    Magnus Lycka
    Aug 5, 2005
  3. Peter Hansen
    Replies:
    0
    Views:
    726
    Peter Hansen
    Feb 22, 2006
  4. Peter Hansen
    Replies:
    0
    Views:
    620
    Peter Hansen
    Feb 22, 2006
  5. flamesrock
    Replies:
    8
    Views:
    517
    Hendrik van Rooyen
    Nov 24, 2006
Loading...

Share This Page