new datetime from format php code example
Example 1: php datetime create
$date = DateTime::createFromFormat('d-m-Y', '15-12-2020');
Example 2: datetime php
$dateTime = new \DateTime();
$dateTime->format('Y-m-d H:i:s');
$date = DateTime::createFromFormat('d-m-Y', '15-12-2020');
$dateTime = new \DateTime();
$dateTime->format('Y-m-d H:i:s');