![]() |
Operating with php date
Hi guys and gals
I am trying to do the following: extract a date from my database, it is MySql and stored as a Date, ie. 2006-11-29 compare this date to todays date using date("Ymd") and find out if the date from the datbase is more or less than 7 days ago, I just cant get it to work! I won't copy my code here, since it is so messed up that nobody would understand it anyway! a working example would be Highly appreciated and almost worth giving a blowjob for.... almost :D |
select if('2006-11-01'>date_sub(curdate(),interval 7 day),'within the last week','more than a week old');
something like that will work. substitute your field name in the place where I put the date |
I use this basic code to do something similar to what you are looking for.
PHP Code:
** DatabaseQuery(); is a self made database access function, so you will have to alter the query to suit your needs, but the rest is straightforward. |
thanks guys, it works now
|
All times are GMT -4. The time now is 11:01 AM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc