i’m trying to get records from a mysql that are included into a certain period between two dates (these two dates are respectively date_start, date_end and are stored in two different columns).
what i’m doing now in my select query is:
.. WHERE MONTH(date_start) >= '".$month_start."' and DAY(date_start) >= '".$day_start."'" AND MONTH(date_end) <= '".$month_end."' and DAY(date_end) <= '".$day_end."'"
that query works but only in some cases, not at all!
Any suggestion please?
table sample here:
id_period;date_start;date_end;
27;0000-04-02;0000-05-31;
|| *id_period* || *date_start* || *date_end* ||
|| 41 || 0000-11-01 || 0000-11-30 ||
Try DATE_FORMAT function instead of using MONTH and DAY. And please confirm that dates in db are in date format