title: PHP - How to fix date_format() error 'boolean given, instead of DateTimeInterface'?
body: <p>I'm getting this error:
  "Warning: date_format() expects parameter 1 to be DateTimeInterface, boolean given in C:...\myFile.php on line 24"</p>
  
  <p>I've tried that code using strtotime instead of time():</p>
  
  <pre><code>$strDate = time();
  $str = strtotime($strDate);
  $date = date_create($str);
  echo date_format($date, "Y/m/d");
  </code></pre>
  
  <p>And works: //--> 2018/12/31</p>
  
  <p>But can't understand why, because both strtotime, and time return same Unix timestamps.</p>
  
  <pre><code>$dtObj = date_create(time(), timezone_open("Europe/Oslo"));
  echo $dtObj . '&lt;/br&gt;'; // Works ok
  date_format($dtObj, "d-m-Y"); // This throws error
  </code></pre>
  
  <p>I expected the same result wiht both codes. Any clue about what's happening?</p>