title: Write date and time into LOG file in PHP
body: <p>I would like to write into my LOG file the current date and time :</p>
  
  <pre><code>$logFileName = 'file://c:\MYLOG.log'; // /var/logs/file.log
  $logContent = "Running through the function".PHP_EOL;
  $date = (new DateTime('NOW'))-&gt;format("y:m:d h:i:s");
  if ($handle = fopen($logFileName, 'a')) 
  {
    fwrite($handle, $date);
    fwrite($handle, PHP_EOL);
    fwrite($handle, $logContent);
    fwrite($handle, PHP_EOL);
    fwrite($handle, $cmdWindows);
    fwrite($handle, PHP_EOL);
    fwrite($handle, $params);
    fwrite($handle, PHP_EOL);
   }
   fclose($handle);
  </code></pre>
  
  <p>When it is running through my method, I can see all my wanted information but not the date and the time.
  Can you tell me where am I wrong please ? Thank you in advance.</p>