I'm having some trouble collecting data between 2 different years (ie: December 2011 & January 2012).
This is a timeclock system where punches are stored as: DD-MM-YYYY (31-12-2011).
I want to be able to search for dates between: DD-MM-2011 through DD-MM-2012 but am coming up empty. When using the same year the query works just fine. Here is my failed code:
$sql = "SELECT * FROM timeclock WHERE user = 'mdloring' AND punch_in BETWEEN '26-12-2011' AND '09-01-2012' ORDER BY punch_in DESC";
There are no MySQL errors, so I think it has something to do with the way I store my dates. I know that MySQL's default date storage is YYYY-MM-DD but I rarely use that.
Any help is greatly appreciated.