extract date from DateTime object php code example
Example 1: extract date from DateTime object php
<?php
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:s');
?>
Example 2: php extract time from datetime
$time = '2013-01-22 10:45:45';
echo $time = date("H:i:s",strtotime($time));
Example 3: extract date from DateTime object php
<?php
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:s');
?>