This will give your wished format:
echo DateTime::createFromFormat('!j.n.Y', "3.4.2012")->format('Y-m-d H:i:s');
Output: 2012-04-03 00:00:00
Excpected output: 2012-04-03 00:00:00
Ref: http://php.net/manual/en/datetime.createfromformat.php
! Resets all fields (year, month, day, hour, minute, second, fraction
and timzone information) to the Unix Epoch Without !, all fields will
be set to the current date and time.
In other words, without the exclamation mark !, if you don't specify any of H (hours), i (minutes), and s (seconds), the current OS system time running the PHP script is used.
If any of the elements H, i, or s are given, the system time is not used. In effect, 0 will fill all unspecified time elements. For example:
echo DateTime::createFromFormat('j.n.Y H', "3.4.2012 22")->format('Y-m-d H:i:s');
//=> 2012-04-03 22:00:00
echo DateTime::createFromFormat('j.n.Y i', "3.4.2012 22")->format('Y-m-d H:i:s');
//=> 2012-04-03 00:22:00
echo DateTime::createFromFormat('j.n.Y s', "3.4.2012 22")->format('Y-m-d H:i:s');
//=> 2012-04-03 00:00:22
format('Y-m-d 00:00:00')instead.