[thelist] Issues working with dates

Joel D Canfield Joel at BizBa6.com
Thu May 7 11:50:26 CDT 2009

> 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