- strftime: documentation ( source)
- strtotime: documentation ( source)
<?php
$time = '2018-06-08 15:20:30';
$dt = new \DateTimeImmutable($time);
$di = new \DateInterval('PT15H20M30S');
echo $dt->format('Y-m-d H:i:s')."\n";
echo $di->format('%H:%I:%s')."\n";
echo strftime('%H:%I:%s', strtotime($time))."\n"; # %I = hodiny (01-12), %s = Unix epoch timestamp
echo strftime('%H:%M:%S', strtotime($time));