Simple way to show to and from date using php
xxxxxxxxxx
$dateto = new DateTime('now');
$datefrom = new DateTime( date('Y-m-d', strtotime("-1 year", time())) );
xxxxxxxxxx
$element = '15-Feb-2009';
$date = DateTime::createFromFormat('j-M-Y', $element);
xxxxxxxxxx
// Output — 11:03:37 AM
echo date('h:i:s A');
// Output — Thursday, 11:04:09 AM
echo date('l, h:i:s A');
// Output — 13 September 2018, 11:05:00 AM
echo date('d F Y, h:i:s A');
?>