I think the format of your date is the key -- if you are not concerned about the time (just comparing by days), you may want to convert the date to a single number; you might use the #seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)... that might help if you decide you need to compare times later on :)

Comparing a single integer is also much easier to debug.

a PHP doc:
http://us2.php.net/manual/en/function.date.php
a Postgres 7 doc:
http://www.postgresql.org/docs/7/static/functions2876.htm

One other tip, off the top of me noggin:  be careful to always compare dates from the same time source -- browsers (assuming this is a webapp) will report the client machine's clock info, which might be out of your control -- and you'd be well-advised to use an NTP service on the server ;)

hope this helps,

    Ben



On 5/31/06, Matthew Jarvis <[EMAIL PROTECTED]> wrote:
I am having a serious brain fart today...

All I wanna do is compare a date I've retrieved from a table to the
current date, and if the interval is more than a year then set a flag so
I can display it in a report.

No problem, but I'll be darned if I can get this to work... Me thinks
I'm confusing my PHP and Postgres...

So if I'm running PHP code and I've got the table date stored to $date,
then how do I do the comparison?

mj

--
Matthew S. Jarvis
IT Manager
Bike Friday - "Performance that Packs."
www.bikefriday.com
541/687-0487 x140
[EMAIL PROTECTED]
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to