title: I have used DatePeriod for preparing dates b/w two dates but not working
body: <p>How can we prepare dates between two dates in php?</p>
  
  <p>I have searched and found a method using DatePeriod. I had tried with this method but result is getting different one. </p>
  
  <pre><code>DatePeriod Object
  (
      [start] =&gt; DateTime Object
          (
              [date] =&gt; 2017-11-23 02:09:17.000000
              [timezone_type] =&gt; 3
              [timezone] =&gt; Europe/Berlin
          )
  
      [current] =&gt; 
      [end] =&gt; DateTime Object
          (
              [date] =&gt; 2017-11-23 05:09:17.000000
              [timezone_type] =&gt; 3
              [timezone] =&gt; Europe/Berlin
          )
  
      [interval] =&gt; DateInterval Object
          (
              [y] =&gt; 0
              [m] =&gt; 0
              [d] =&gt; 1
              [h] =&gt; 0
              [i] =&gt; 0
              [s] =&gt; 0
              [weekday] =&gt; 0
              [weekday_behavior] =&gt; 0
              [first_last_day_of] =&gt; 0
              [invert] =&gt; 0
              [days] =&gt; 
              [special_type] =&gt; 0
              [special_amount] =&gt; 0
              [have_weekday_relative] =&gt; 0
              [have_special_relative] =&gt; 0
          )
  
      [recurrences] =&gt; 1
      [include_start_date] =&gt; 1
  )
  </code></pre>
  
  <p>Date is passing from jquery post. </p>
  
  <pre><code>&lt;?php
  $dates       = '02.09.17 - 05.09.17';
  $daterange   = explode(" - ", $dates);
  $dateBegin   = $daterange[0];
  $dateEnd     = $daterange[1];
  
  $period      = new DatePeriod(new DateTime($daterange[0]), new DateInterval('P1D'), new DateTime($daterange[1]));                
  
  print_r($period);
  
  ?&gt;
  </code></pre>