convert seconds into formatted time

{ // deep_execution_view
const authorName = "Anushri Mathur";
//
const publishDate = "August 30, 2016";
function convertTime($sec) {
$dta = new \DateTime('@0');
$dtb = new \DateTime("@$sec");
return $dta->diff($dtb)->format('%a days, %h hours, %i minutes and %s seconds');
}
}