[thelist] CF date comparison problem

jeff jeff at members.evolt.org
Fri Jan 12 20:30:31 CST 2001


: From: Chris Silwedel
: this works fine to retrieve the relevant concert
: details until the day of the concert, the listed
: concert is taken off because it appears CF isn't
: recognising that the now() date is equal to
: showdate.

that's because it compares it down to the second.

: i did a test page and this is an example of what
: the two values actually are equal to:
: Now: {ts '2001-01-12 19:38:40'}
: Show date: 2001-01-13 00:00:00

that is to be expected.  you'll also notice that they're not equal and one
is indeed before the other.  to get a non-time based comparison you're going
to have to get creative.

: do i actually have two problems here as i really don't
: need time recorded for showdate - does this need to
: be fixed in the database itself?

no, don't sweat the time.  it's just a logical portion of the datetime
datatype.  the trick is learning how to work with it.

: and what about the now() date format, should i
: even be using now() at all?

you should if you want to compare the date in the database against the
current time.  ;)

: any help would be GREATLY appreciated - can't
: have the kids missing a good concert can we ;)

the trick here is to push the comparison to the date level, ignoring the
time portion of it.  depending on your database (i'm assuming you're using
access), one way to do it would be to put a dateformat() on the now() to
restrict to just the date.  that would look like this:

show.showdate >= DateFormat(Now())

if that doesn't do it then you'll need to look into formatting the column on
the left side of the operand into just a date as well when doing the
comparison.  let us know more about the database and we can address it.

good luck,


mailto:jeff at members.evolt.org

More information about the thelist mailing list