Re: date field
| From: | Jasper Bryant-Greene | Date: | Thu, 11 Aug 2005 05:18:12 +0000 |
| Subject: | Re: date field | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-220402@lists.php.net to get a copy of this message | ||
John Taylor-Johnston wrote:
I have a field 'updated' How can I tell if the date is older than 1 year ago (or should I think of 365 days)?
updated date NOT NULL default '1999-12-12'
From the description you gave it looks like you're using a DBMS to store the date. If it's MySQL, then just do an SQL query with a WHERE clause like this:
WHERE updated > DATE_SUB(NOW(), INTERVAL 1 YEAR)
Jasper