phpvms/app/Facades/Utils.php

20 lines
403 B
PHP
Raw Normal View History

2017-07-04 11:53:49 +08:00
<?php
namespace App\Facades;
use \Illuminate\Support\Facades\Facade;
class Utils extends Facade
{
public static function secondsToTime($seconds, $incl_sec=false) {
2017-07-04 11:53:49 +08:00
$dtF = new \DateTime('@0');
$dtT = new \DateTime("@$seconds");
$format = '%hh %im';
if($incl_sec) {
$format .= ' %ss';
}
return $dtF->diff($dtT)->format($format);
2017-07-04 11:53:49 +08:00
}
}