Using cdate function to display data under criteria

Discussion in 'ASP General' started by email0203@comcast.net, Jul 7, 2006.

  1. Guest

    Hello -
    I'm new to the groups here, so bear with me :) I am trying to
    change an existing function that currently only displays records that
    fall under a criteria of

    NOT(now>cdate(OTDate & ' 2:00 AM')

    If I wanted to change this function to display entries that are before
    6:00 pm the day before the OTDate, how could I modify this part of my
    code? should is be something like this...

    NOT(now>cdate((OTDate -1) & ' 6:00 PM')


    Thanks

    D
    , Jul 7, 2006
    #1
    1. Advertising

  2. Evertjan. Guest

    wrote on 07 jul 2006 in microsoft.public.inetserver.asp.general:

    > Hello -
    > I'm new to the groups here, so bear with me :) I am trying to
    > change an existing function that currently only displays records that
    > fall under a criteria of
    >
    > NOT(now>cdate(OTDate & ' 2:00 AM')
    >
    > If I wanted to change this function to display entries that are before
    > 6:00 pm the day before the OTDate, how could I modify this part of my
    > code? should is be something like this...
    >
    > NOT(now>cdate((OTDate -1) & ' 6:00 PM')


    You would not need the outer () here

    NOT a>b

    is the same as:

    a<=b

    and since exact equality on the milisecond is unimportant
    in a real time testing like below,
    that is the same here as:

    a<b

    ================================

    I would never make a date by concatenating strings,
    and I would never use am/pm.
    So no need for cdate here.

    ================================

    try:

    OTDate = #2006/7/8# 'tomorrow
    if now < dateadd("h",2,OTDate) then
    duty = "John" 'before 2 am for Americans
    elseif now < dateadd("h",18,OTDate) then
    duty = "Pete" 'between 2 am and 6 pm for Americans
    else
    duty = "Bill" 'after 6 pm for Americans
    end if



    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan., Jul 7, 2006
    #2
    1. Advertising

  3. Guest

    The purpose of this particular screen is to only show certain records
    based on criteria. Our employees use this online interface to sign up
    for, modify, and cancel overtime that our operations department posts.
    Once an employee signs up for available overtime, we require them to
    provide ample notice to cancel/modify so that we are aware of what our
    availability will be for the following work day. here is more of the
    code, perhaps this will help to explain - we basically want to require
    them to inform us by 6pm the day before the actual signed up overtime
    date ( so if I sign up for 7/13/06, I have until 6pm on 7/12/06 to
    cancel/modify that date ) We use this "criteria" code to display the
    overtime signed up for. Hope this helps. Thanks!

    ' Retreive the term being searched for.
    reqOTDate = Request.QueryString("txtOTDate")
    if IsDate(reqOTDate) then
    reqOTDate = reqOTDate
    else
    reqOTDate = ""
    end if

    ' Retrieve page to show or default to the first
    If Request.QueryString("page") = "" Then
    iPageCurrent = 1
    Else
    iPageCurrent = CInt(Request.QueryString("page"))
    End If

    'Build dynamic sql.
    sql = "select * from tbl_Employee "

    If blnWhere Then sql = sql & " AND " Else sql = sql & " WHERE " :
    blnWhere = True
    sql = sql & "UserID = " & session("UserID") & " AND deleted='no' AND
    NOT(now>cdate(OTDate & ' 2:00 AM'))"
    , Jul 11, 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. Teemu Keiski

    Re: cdate

    Teemu Keiski, Jul 3, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    545
    Teemu Keiski
    Jul 3, 2004
  2. Replies:
    1
    Views:
    361
    mlimber
    Jul 21, 2006
  3. psychomad
    Replies:
    2
    Views:
    5,165
    Alexey Smirnov
    Apr 10, 2007
  4. DC
    Replies:
    1
    Views:
    1,105
  5. Bobby Edward
    Replies:
    1
    Views:
    4,440
    Kevin Spencer
    Mar 5, 2008
Loading...

Share This Page