Time() range

Discussion in 'ASP General' started by le0, Jul 20, 2006.

  1. le0

    le0 Guest

    Hello Guys,

    I have this dropdown box and the options is TimeShift (6a-2pm, 2p-10p, 10p-6a ), im getting this data in a table (Acess DB) . My problem is how can i display (option selected) the actual shift based on the actual time.

    Code:

    <td width="100" height="5"><select size="1" name="ddShift">

    <%Do While Not rstShift.EOF%>
    <option value="<%=rstShift.Fields("ShiftID").Value%>"><%=rstShift.Fields("Shift").Value%></option>
    <%
    rstShift.Movenext
    Loop
    %>

    or can i do it manually, but the problem is the <Condition statement>, im using "Between" like querying a date range in a database but it doesnt work. How can i get the range in Time()? Please Helpppp...

    <%if <Condition> then%>
    <option selected value="A"><%="6am-2pm"%></option>
    <%end if%>

    btw im using Frontpage and ASP Classic
    le0, Jul 20, 2006
    #1
    1. Advertising

  2. le0

    Mike Brind Guest

    le0 wrote:
    > Hello Guys,
    >
    > I have this dropdown box and the options is TimeShift (6a-2pm, 2p-10p, 10p-6a ), im getting this data in a table (Acess DB) . My problem is how can i display (option selected) the actual shift based on the actual time.
    >
    > Code:
    >
    > <td width="100" height="5"><select size="1" name="ddShift">
    >
    > <%Do While Not rstShift.EOF%>
    > <option value="<%=rstShift.Fields("ShiftID").Value%>"><%=rstShift.Fields("Shift").Value%></option>
    > <%
    > rstShift.Movenext
    > Loop
    > %>
    >
    > or can i do it manually, but the problem is the <Condition statement>, im using "Between" like querying a date range in a database but it doesnt work. How can i get the range in Time()? Please Helpppp...
    >
    > <%if <Condition> then%>
    > <option selected value="A"><%="6am-2pm"%></option>
    > <%end if%>
    >
    > btw im using Frontpage and ASP Classic


    <%
    Dim shift
    shift=""
    If DatePart("h", Now()) > 5 And DatePart("h", Now()) < 14 Then shift =
    " selected"
    If DatePart("h", Now()) > 13 And DatePart("h", Now()) < 22 Then shift =
    " selected"
    If DatePart("h", Now()) > 21 Or DatePart("h", Now()) < 6 Then shift = "
    selected"
    %>

    <option value="A" <%=shift%>>6am-2pm</option>
    <option value="B" <%=shift%>>2pm-10pm</option>
    <option value="C" <%=shift%>>10pm-6am</option>

    --
    Mike Brind
    Mike Brind, Jul 20, 2006
    #2
    1. Advertising

  3. le0

    le0 Guest

    Hey Mike thanks =)
    I really apreciate that =)

    "Mike Brind" <> wrote in message
    news:...
    >
    > le0 wrote:
    >> Hello Guys,
    >>
    >> I have this dropdown box and the options is TimeShift (6a-2pm, 2p-10p,
    >> 10p-6a ), im getting this data in a table (Acess DB) . My problem is how
    >> can i display (option selected) the actual shift based on the actual
    >> time.
    >>
    >> Code:
    >>
    >> <td width="100" height="5"><select size="1" name="ddShift">
    >>
    >> <%Do While Not rstShift.EOF%>
    >> <option
    >> value="<%=rstShift.Fields("ShiftID").Value%>"><%=rstShift.Fields("Shift").Value%></option>
    >> <%
    >> rstShift.Movenext
    >> Loop
    >> %>
    >>
    >> or can i do it manually, but the problem is the <Condition statement>, im
    >> using "Between" like querying a date range in a database but it doesnt
    >> work. How can i get the range in Time()? Please Helpppp...
    >>
    >> <%if <Condition> then%>
    >> <option selected value="A"><%="6am-2pm"%></option>
    >> <%end if%>
    >>
    >> btw im using Frontpage and ASP Classic

    >
    > <%
    > Dim shift
    > shift=""
    > If DatePart("h", Now()) > 5 And DatePart("h", Now()) < 14 Then shift =
    > " selected"
    > If DatePart("h", Now()) > 13 And DatePart("h", Now()) < 22 Then shift =
    > " selected"
    > If DatePart("h", Now()) > 21 Or DatePart("h", Now()) < 6 Then shift = "
    > selected"
    > %>
    >
    > <option value="A" <%=shift%>>6am-2pm</option>
    > <option value="B" <%=shift%>>2pm-10pm</option>
    > <option value="C" <%=shift%>>10pm-6am</option>
    >
    > --
    > Mike Brind
    >
    le0, Jul 20, 2006
    #3
    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. Replies:
    46
    Views:
    967
    Antoon Pardon
    Jul 25, 2006
  2. flamesrock
    Replies:
    8
    Views:
    451
    Hendrik van Rooyen
    Nov 24, 2006
  3. Lambda
    Replies:
    2
    Views:
    397
    James Kanze
    Jul 16, 2008
  4. loudking
    Replies:
    3
    Views:
    479
    Ben Bacarisse
    Nov 30, 2009
  5. Tomoyuki Kosimizu

    Range does not take an Range object.

    Tomoyuki Kosimizu, Nov 25, 2003, in forum: Ruby
    Replies:
    3
    Views:
    151
    Tomoyuki Kosimizu
    Nov 27, 2003
Loading...

Share This Page