[thelist] Issues working with dates

Todd Richards todd at promisingsites.com
Thu May 7 14:05:18 CDT 2009

Hi Joel -

I think I have the first issue figured out.  I wasn't thinking it through
all the way, so I'll work on that and report back if there are still issues.

The dates are stored in a MS SQL database.  The dev server is running MS SQL
2000 and the production server was just upgraded to 2008 (big difference,
huh?)  :)

They are stored in a datetime field.  I was simply doing an "order by
endDate", but I guess that's probably not the best way to do it?


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

> around with a dateDiff(), comparing the addedOn date with the current
> date,
> but that doesn't seem to be working.

what specific problem are you having?

> - Is it possible to do it the way I'm thinking (using the dateDiff
> the
> AddedOn field?  Should I be using a value "date()" rather than "now()"
> when
> entering the records, if I'm looking to compare the values?

if you'll never use the time, yeah, just use the date

> - Should I add another field in there for them to set a date to keep
> "featured"?

if you need one date field for "when it was added" and another for
"shelf life, sell by date" or whatever, yeah, two fields, if they're not
linked by some calculable number

> ISSUE 2:
> I'm listing upcoming events on an events page.  I'm trying to do
> "order by endDate" (in format of mm-dd-yyyy).  I thought it was
> but
> last night I changed a date and now it's broke.  It seems that it's
> ordering
> by the "mm" part.  So if I have two dates, "05-11-2009" and
> they are in the correct order.  But if I have  two events with dates
> "04-05-2022" and "10-22-2009", the one in 2022 comes first.

are your dates in a database, I'm assuming? which one? how is it storing
the dates, as a datetime field, or as strings? how are you doing the
comparison or sorting?


More information about the thelist mailing list