ckroon
Posts: 869
|
| Posted: 09/16/2006, 10:38 AM |
|
PHP/Mysql
I have an application that lists educational reports and each record has an expiry date.
I want a grid that will list all reports that are set to expire within six months.
I tried this:
WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) < exp_date;
but that doesn't do what I want.
Any suggestions?
_________________
Walter Kempees...you are dearly missed. |
 |
 |
peterr
Posts: 5971
|
| Posted: 09/16/2006, 11:41 AM |
|
You would need to add 6 months to the current date, and check if it is not larger then the expiration date:
WHERE exp_date <= DATE_ADD(CURDATE(),INTERVAL 6 MONTH);
(not tested, just based on http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html)
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
|