title: How to change the time with one day plus in mysql?
body: <p>I am using CodeIgniter and I need to get daily sales details by date. Below is my MySQL query statement, and in it I need to take values everyday from 15:00:00 to 06:00:00 the next morning (ie, today's date is 29-9-2015, and for this result I need the data to be from 29-9-2015 15:00:00 to 30-9-2015 06:00:00). </p>
  
  <p>I have tried so many ways. It is working only based on the daily hours from 15:00:00 to 24:00:00. If I give 06 instead of 24 then this does not work because the 06 is the next day's hour. I don't know how to +1 the day with hours in MySQL.</p>
  
  <pre><code>SELECT DATE_FORMAT( date, '%e' ) AS date, SUM( COALESCE( total_tax, 0 ) ) AS tax1, SUM( COALESCE( total_tax2, 0 ) ) AS tax2, SUM( COALESCE( total, 0 ) ) AS total, SUM( COALESCE( inv_discount, 0 ) ) AS discount, SUM( COALESCE( cash_amt, 0 ) ) AS cash, SUM( COALESCE( master_amt, 0 ) ) AS master, SUM( COALESCE( visa_amt, 0 ) ) AS visa, SUM( COALESCE( nets_amt, 0 ) ) AS nets, SUM( COALESCE( coupon_amt, 0 ) ) AS coupon, SUM( COALESCE( paid, 0 ) ) AS paid FROM sales WHERE (DATE_FORMAT( date, '%Y-%m' ) = '2015-09') AND (DELETE_STATUS != 'Deleted') AND DATE_FORMAT( DATETIME, '%H' ) BETWEEN '15' AND '24' GROUP BY DATE_FORMAT( DATETIME, '%e' );
  </code></pre>
  
  <p>I have attached my output screenshot with the result of 15 to 24 hours. I think you got my question.   </p>
  
  <p><a href="https://i.stack.imgur.com/v5zhu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v5zhu.png" alt="enter image description here"></a></p>