For Programmers: Free Programming Magazines  


Home > Archive > PHP DB > March 2005 > Re: [PHP-DB] Date problem again ;-)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PHP-DB] Date problem again ;-)
Forest Liu

2005-03-23, 3:56 am

I suppose there is a " submit_time" field in your DB table, so you could:
"SELECT * FROM `tablename` WHERE `submit_time`>=3D".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> wro=
te:
> Hi there everyone,
>=20
> OK I'm using the following in my query to display entries in the LAST 3
> days:
>=20
> DATE_SUB(CURDATE(),INTERVAL 3 DAY) <=3D ListingDate
>=20
> But it doesn't seem to affect the results, the date format in my DB colum=

n
> (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 i=

s
> the case I'm not sure how to approach this because the data MUST be in th=

e
> 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 betwe=

en.
>=20
> I'm using PHP 4 with MySQL 4.0.22 (Not the latest MySQL I know, sigh).
>=20
>=20
> Chris
>=20
>=20



--=20
Sincerely,
Forest Liu(=E5=88=98=E4=BA=91=E8=B5=9F)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com