RipCurl
|
| Posted: 02/13/2003, 2:39 PM |
|
I have an events table in my database, that uses event_id, event, description and date (date refers to the day it happens). How would I construct a grid to show ONLY those events that occur from now till only 7 days from now. I will have events posted that will happen say a year from now, but I dont want those to show up till they are supposed to.
Any help appreciated ( Using CC 2.0.5 and PHP with templates)
|
|
|
 |
DaveRexel
|
| Posted: 02/13/2003, 3:11 PM |
|
Here is an example that uses date functions. The following query selects all records with a date_col value from within the last 30 days:
mysql> SELECT something FROM tbl_name
WHERE TO_DAYS(NOW()) - TO_DAYS(date_col) <= 30;
=== similar logic
Hope this helps you as it once helped me :)
Greetings
Dave
|
|
|
 |
RipCurl
|
| Posted: 02/13/2003, 3:43 PM |
|
Thanks, but where do i insert this code into CC for the Grid? In the SQL? or Custom show?
|
|
|
 |
RipCurl
|
| Posted: 02/13/2003, 3:45 PM |
|
I should add that the "date" column in the table is using MySql's date format (0000-00-00).
In addition, how do I diplay the dat as MM-DD-YYYY in the grid?
|
|
|
 |
Ripcurl
|
| Posted: 02/13/2003, 6:52 PM |
|
Just to say I got it to work. Had to swtich the TO_DAYS around, so that it displayed hte correct info ^_^
Dani
|
|
|
 |
|