I have been trying to figure out the best possible way to do a date search in a query. I am using mysql 4.0.12 or something close to that. I also have a php script that will take a start date and an end date. These dates get put into the where clause. I have done a couple of things in the past but I am not sure if there is a better way of doing this. Here is what I have done in the past
WHERE date BETWEEN '2004-09-01 00:00:00' AND '2004-09-17 23:59:59'
The field type for this column is datetime.The time in this where statement is hardcoded and the user has to input the dates in this format ( yyyy-mm-dd ). I have tried other variations as well but I haven't found a bullet proof way yet. Any suggestions??
Thanks