title: save sql datetime to php variables
body: <pre class="lang-php prettyprint-override"><code>$date =$row2['DeliveryDate'];
  </code></pre>
  
  <p><code>$date</code> now contains the date variable as a datetime, to display it I would use:</p>
  
  <pre class="lang-php prettyprint-override"><code>echo date_format($date, 'm-d-y');
  </code></pre>
  
  <p>the problem I'm having is extracting single values from $date for example:</p>
  
  <pre class="lang-php prettyprint-override"><code>$datetime = strtotime($row2['DeliveryDate']);
  $mysqldate = date("d", $datetime);
  </code></pre>
  
  <p>returns this error:</p>
  
  <pre class="lang-none prettyprint-override"><code>Warning: strtotime() expects parameter 1 to be string, object given in
  C:\xampp\htdocs\tutorials\DerBlatt\hebrewDateTrial.php on line 10
  </code></pre>
  
  <p>I've tried numerous ways to extract the day/month/year into single variables but nothing works
  if someone can suggest a way it might work I'll be very greatfull;
  I've copy/pasted code from many sites but all of them use an example of the date as a string, unfortunately i haven't found a solution for the datetime variable.</p>
  
  <p>I wanna do something like:</p>
  
  <pre class="lang-php prettyprint-override"><code>$date =$row2['DeliveryDate'];
  //whatever conversion code that comes in between.
  $d = //the day from datetime
  $m = //the month from datetime
  $y = //the year from datetime
  </code></pre>