title: DateTime::createFromFormat() expects parameter 2 to be string, object given
body: <p>I am trying to get output as Current date and Time as 0:0:0
  Below is my code.</p>
  
  <pre><code>$StartDate = new \DateTime('now');
  $StartDate = $StartDate-&gt;setTime(0, 0, 0);
  echo \DateTime::createFromFormat('Y-m-d', $StartDate);
  </code></pre>
  
  <p>but I am getting error below.</p>
  
  <blockquote>
    <p>DateTime::createFromFormat() expects parameter 2 to be string, object
    given</p>
  </blockquote>