I have a MySQL DB table with multiple date type fields. I need to do different SELECT queries on this table but I am not sure which way is the best to find records from the same month.

I know I can do the following:

```
SELECT *
  FROM table
 WHERE MONTH(somedate) = 5
   AND YEAR(somedate) = 2015

```

But I keep reading that isn't efficient and that I should go with using actual dates, i.e.

```
SELECT *
  FROM table
 WHERE somedate BETWEEN '2015-05-01' AND '2015-05-31'

```

However, all I would have is the month and the year as variables coming in from PHP. How do I easily and quickly calculate the last day of the month if I go with second option?