PHP 日期函数 date_time_set()


PHP 日期函数 date_time_set()

<?php
   $dateSrc = '2007-04-19 12:50 GMT';
   $dateTime = date_create( $dateSrc);;
   $retval = date_time_set( $dateTime, 20, 40, 10);

   echo 'DateTime::format(): '.$dateTime->format('Y:M:D:H:i:s');
   echo "\n";

   # Using second function.
   $dateTime = new DateTime($dateSrc);
   $retval = $dateTime->setTime(20, 56,6);

   echo 'DateTime::format(): '.$dateTime->format('Y:M:D:H:i:s');
?>