- time: documentation ( source)
- sprintf: documentation ( source)
<?php
$now = time();
$ts = new \DateTime('@1368007801');
echo $ts->format('c') . PHP_EOL;
$diff = $now - $ts->getTimestamp();
echo $diff . PHP_EOL;
echo sprintf('%02d:%02d:%02d', ($diff / 3600), ($diff / 60 % 60), $diff % 60);