DateTime() works wrong DateTime() works wrong symfony symfony

DateTime() works wrong


Mainly because you're using it wrong, you need to properly use DateTime methods.

In this case, use ->format(). For more information please read the manual. Consider this example:

$myDate = new \DateTime();// yyyy-mm-dd hh:mm:ssecho $myDate->format('Y-m-d H:i:s'); // output: 2014-05-26 20:54:21// timestampecho $myDate->getTimestamp(); // output: 1401108861