[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
with
> 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
it
> "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
simple
> "order by endDate" (in format of mm-dd-yyyy).  I thought it was
working
> 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
"11-10-2009",
> they are in the correct order.  But if I have  two events with dates
of
> "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?

joel




More information about the thelist mailing list