title: how to get the first and last days of a given month
body: <p>I wish to rewrite a mysql query which use month() and year() functions to display all the posts from a certain month which goes to my function as a 'Y-m-d' parameter format, but I don't know how can I get the last day of the given month date.</p>
  
  <pre><code>$query_date = '2010-02-04';
  list($y, $m, $d) = explode('-', $query_date);
  $first_day = $y . '-' . $m . '-01';
  </code></pre>