[thelist] Dates, ASP and mental health

Warden, Matt mwarden at odyssey-design.com
Fri Mar 30 17:43:07 CST 2001


Ryan,

> I am working on an events calendar, built in ASP running off a SQL 7
> Database Server..
...
> I am grabbing all the events from the database and looping through them and
> displaying the ones which match the following if statement..

OUCH! See below...

> -------------
> IF objRS("dteEvStart") <= view_date and objRS("dteEvEnd") >= view_date THEN
>
> do this
>
> END IF
> -------------
> This seems to only half work.. it works fine one some dates, but others it
> hates and it seems to ignore the year completely. Example: An event which
> should only show up between April 12 and April 15, 2001  will also show up
> between April 12 and April 14, 2003
>
> I have also tried grabbing the proper events right in my SELECT statement,
> which is what I would prefer to do, but that seemed to return no results.

This is what I need to know:

what datatype are the startdate and enddate fields?
what variable type is view_date?
have you printed out the output of view_date and compared that with example
values from the database? If so, please include those formats. If not, do it
=P

Like Dave said, try using CDate(). However, depending on the formats of both
your variable and the database field, it could be better to just compare
[insert datatype of those here].




--
mattwarden
mattwarden.com





More information about the thelist mailing list