Re: Date problem again ;-)
| From: | Forest Liu | Date: | Wed, 23 Mar 2005 03:57:30 +0000 |
| Subject: | Re: Date problem again ;-) | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-39011@lists.php.net to get a copy of this message | ||
I suppose there is a " submit_time" field in your DB table, so you could:
"SELECT * FROM
tablename WHERE submit_time>=".lastdays(3)
lastdays() is a function you could create using mktime(),time(), and date()
On Tue, 22 Mar 2005 16:28:39 -0500, Chris Payne <cjp@planetoxygene.com> wrote:
> Hi there everyone,
>
> OK I'm using the following in my query to display entries in the LAST 3
> days:
>
> DATE_SUB(CURDATE(),INTERVAL 3 DAY) <= ListingDate
>
> But it doesn't seem to affect the results, the date format in my DB column
> (ListingDate - datatype is Date) is 2000-00-00 as in year, month and date -
> is THAT the problem? That it needs to be an actual timestamp? If that is
> the case I'm not sure how to approach this because the data MUST be in the
> above format as it comes from a central DB every night. All I need to do is
> display the current date plus also the previous x amount of days in between.
>
> I'm using PHP 4 with MySQL 4.0.22 (Not the latest MySQL I know, sigh).
>
>
> Chris
>
>
--
Sincerely,
Forest Liu(刘云赟)