I have a date like this: 20-03-2016 10:28:24.8402750
the field on my database is a DateTime
. When I try to insert a record with the date above, I get: 0000-00-00 00:00:00
I also tried with TimeStamp
and same problem. What am I doing wrong?
UPDATE:
this is my code for generate the date:
$now = new DateTime(null, new DateTimeZone('Europe/Rome'));
$now->getTimezone();
$result = $now->format('d-m-Y H:i:s') . substr((string)microtime(), 1, 8);
return $result;