php create datetime form stirng code example
Example 1: php datetime create
$date = DateTime::createFromFormat('d-m-Y', '15-12-2020');
Example 2: create date from string php
$element = '15-Feb-2009';
$date = DateTime::createFromFormat('j-M-Y', $element);