title: Filter Dates in sql by months - php,sql
body: <p>I have a table in sql and in that table I have column with the action date by this format: 2015-08-26 05:54:39</p>
  
  <p>Now I built a system in php and i want to get all the actions that was in the same month.</p>
  
  <p>I try to run that:</p>
  
  <pre><code>SELECT * FROM `Expenses` WHERE DateAction between '2015-08-01 00:00:00' and '2015-09-01 00:00:00'
  </code></pre>
  
  <p>and its return the actions dates that was in the same month, But its can return the the action that was in 2015-09-01 00:00:00 so i understand i need to get the last day in the month and put it in the sql query.</p>
  
  <p>How I do that?</p>
  
  <p>Right now this is the call to the sql:</p>
  
  <pre><code>$query = mysql_query("SELECT * FROM `Expenses` WHERE `accountid` = $accountId");   
  </code></pre>