1

How to output the current time like this 0000-00-00 00:00:00.000000 in php?

I tried everything W3Schools PHP Date Time page had, but didn't get the above format.

Hikki
  • 484
  • 1
  • 10
  • 21
  • 3
    Reading the actual [PHP manual](https://www.php.net/manual/en/function.date) is more helpful than w3schools. – Nick Apr 23 '20 at 07:04
  • 2
    The suggested answer to this question does not mention the PHP `DateTime` class. You can resolve the wanted result with a one liner: `$date = (new DateTime())->format('Y-m-d H:i:s.u);`. So the answer to this question is not complete, because it does not mention the `DateTime` class. – Marcel Apr 23 '20 at 07:12

0 Answers0