[thelist] Issues working with dates

Todd Richards todd at promisingsites.com
Fri May 8 17:06:46 CDT 2009


Hi Joel -

Since calling date() yields mm/dd/yyyy, I assumed that I needed to format it
so that it was the same as what was in the database (yyyy/mm/dd).

Am I sure that I'm comparing dates, and not text strings?  The columns in
the database are datetime, but I am using a date picker to ensure
consistency, and that is getting entered.  So I would assume I'm comparing
dates?

What I've been trying is to set up my query so that 
Query = "select * from DB where event_end_Date <= " & eventDate (or date())
& " order by eventStartDate"

Is that not correct?

Todd

 


-----Original Message-----
From: Joel D Canfield [mailto:Joel at BizBa6.com] 
Sent: Friday, May 08, 2009 2:50 PM
To: todd at promisingsites.com; thelist at lists.evolt.org
Subject: RE: [thelist] Issues working with dates

> Now I'm trying to not show the expired events.  I'm calling the
date(),
> then
> formatting it so that it's yyy/mm/dd format

why not just work with as datetime data?

> (which is set to the variable
> "eventDate").  That part works.  I'm trying to pull a query from the
DB
> "where event_End_Date >= eventDate", and I get all of the dates.  If I
do
> event_End_Date <= eventDate", then I get no dates (as I shouldn't).
I'm
> testing it right now with one event with an end date of 7/9/2008, and
> another with 3/12/2009.

are you sure you're comparing dates, and not text strings?

why not do this in SQL instead of the vbscript in the page?

a possible hole in the logic: shouldn't you be comparing an event's date
to the current date on the calendar? I mean, won't the event's end date
*always* be greater than or equal to the event's date? most stuff ends
after it started ;)

joel






More information about the thelist mailing list