In access i used this and its works fine:
(tblReservations_Dates.Date) Between #" & dteBegDate & "# And #" & dteEndDate & "#
Using MySQL I used this:
(tblReservations_Dates.Date) Between '" & dteBegDate & "' And '" & dteEndDate & "'
However the data is not displayed I was just wondering if this is the correct syntax for SQL Statement for comparing dates?
Use STR_TO_DATE to safely convert whatever you're providing into a date datatype for MySQL. If you provide the date format, I'd be happy to update my answer with an example.
You need to make certain that the date strings (dteBegDate and dteEndDate) are in the format expected by MySQL, which would be YYYY-MM-DD HH:MM:SS. So, right now would be
2009-11-25 21:45:52
(in Pacific time). Other than that, it should work fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.