public static function getDateTimes($time)
    {

        if (is_numeric($time)) {
            $intTime = $time;
        } else {
            $intTime = strtotime(strval($time));
            if ($intTime === false) {
                throw new \Exception("$time is invalid format");
            }
        }
        $res = date('c', $intTime);

        return substr($res, 0, 19);

    }
public static function getDateTimes($time)
    {

        if (is_numeric($time)) {
            $intTime = $time;
        } else {
            $intTime = strtotime(strval($time));
            if ($intTime === false) {
                throw new \Exception("$time is invalid format");
            }
        }
        $res = date('c', $intTime);

        return substr($res, 0, 19);

    }
public static function getDateTimes ( $ time ) { if ( is_numeric ( $ time ) ) { $ intTime = $ time ; } else { $ intTime = strtotime ( strval ( $ time ) ) ; if ( $ intTime === false ) { throw new \ Exception ( "$time is invalid format" ) ; } } $ res = date ( 'c' , $ intTime ) ; return substr ( $ res , 0 , 19 ) ; }
Generate a datetime format string


@param $time  timestamp or date string
@return string
@throws \Exception
Generate a datetime format string