In a DB table I have several fields with datetime
as field type. So I need to persist data only as date time object.
From a form I get date time as string l
i always create DateTime object with its constructor, os in your case it would be:
$protocol->setStartedAt(new \DateTime($post['started_at']));
if this works, but does not use the timestamp posted you probably do not have the value in $post['started_at']. Try debuging it or just do the dirty trick:
die($post['started_at']);