Using cdate function to display data under criteria

E

email0203

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
 
E

Evertjan.

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
 
E

email0203

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'))"
 

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,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top