php - SQL compare dates
I am trying to calculate if a date is between a few dates that are in my database.1
For example:
I have the date:29-02-2016
I have some entries in my database that have 2 columns, astart date
and aend date
.
Now I want to select rows of my database that collide with the example date. All the dates are in timestamps.
So for example I have in my database the next rows:
start date: 11-2-2016 => end date: 12-2-2016 //does not match
start date: 28-2-2016 => end date: 30-2-2016 //does match
Does anyone know how to select them from my database?
Answer
Solution:
Do you just want to select the rows where your_date is in between
start_date
andend_date
? A simplebetween
clause would do that.