I have a database and I want to display the entries that are dated for the current day.
so I have this statement:
SELECT * FROM class where start_date <= NOW() and where end_date >= NOW();
I realize the syntax of the above is probably wrong, but you get the idea...
I know the NOW() function is longer than what I need for the compare. My start_date and end_date variable are set as "date" with each one appearing in the database like this: "2001-07-31".
How can I compare the current date/time to my start_date and end_date variables... and have the NOW() function actually compare in the same format as my variables? Or is there an easier way?
Help appreciated.
so I have this statement:
SELECT * FROM class where start_date <= NOW() and where end_date >= NOW();
I realize the syntax of the above is probably wrong, but you get the idea...
I know the NOW() function is longer than what I need for the compare. My start_date and end_date variable are set as "date" with each one appearing in the database like this: "2001-07-31".
How can I compare the current date/time to my start_date and end_date variables... and have the NOW() function actually compare in the same format as my variables? Or is there an easier way?
Help appreciated.