<?php

namespace App\Helpers;

use Illuminate\Support\Facades\DB;

class ITime
{
    
    public static function getTimeDiffMinute($_ftime, $_ttime)
    {
        $sql = "SELECT TIME_TO_SEC(timediff('{$_ttime}', '{$_ftime}'))/60 as t";   
        $d = DB::select($sql);
        if (count($d) > 0) {
            return $d[0]->t;
        } else {
            return null;
        }
    }

    public static function conVertminTOHour($minutes)
    {
        return date('H:i', mktime(0, $minutes));
    }
}