i have a table which is getting longer and takes tiem to download. i want to filter out the old entries. i only know how to display entries using current_date but i don’t know how to display the ones with future dates. how is this done?
If you figure out the timezone of your server first, you can use either of the following functions to adjust the date:
To add some hours to the date:
DATE_ADD(CURRENT_DATE(), INTERVAL 5 HOUR);
To substract some hours:
DATE_SUB(CURRENT_DATE(), INTERVAL 5 HOUR);
Is there a way to set it to GMT+4 time since I am in Dubai? I seem to be getting the date of my server which is in the US.
The server’s today date.
I just openned my page and i seem to be stuck with yesterday’s date, 20July 2010. Isn’t Current_Date equal to today’s date?
Change datefield > CURRENT_DATE to datefield >= CURRENT_DATE
I tried this with WHERE datefield > CURRENT_DATE
but it is filtering out the date today. I tried datefield => CURDATE() but it is showing error.
SELECT field1 , field2 FROM tablename WHERE datefield > CURDATE()
It’s working fine now. the table displays the entries with the future dates and the date today. Thanks!