PHP - 将两组数字(hr和min)转换为时间

In php is there a way to turn two integers (09 and 30) into into type time (9:30). I need this function so I can INSERT these number into a column in MySQL of type time.

setTime

$datetime = new DateTime(); 
$datetime->setTime(9, 30, 0); 
DateTime::format ( string $format )

will do

$str = '09:' +'30';
$date = DateTime($str);
$date->format('H:i')

In php is there a way to turn two integers (09 and 30) into into type time (9:30). I need this function so I can INSERT these number into a column in MySQL of type time.

Yes, by formating them as string:

$hr  = 9;
$min = 30;

$time = sprintf('%02d:%02d', $hr, $min);

echo $time; # 09:30

As hakre said, use sprintf.

$hours = 9;
$minutes = 30;

$time = sprintf("%02d:%02d:00", $hours, $minutes);
$a1 = array("09","30");
$date implode(":",$a1);