<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ` ~~~ <?php /** * Created by PhpStorm. * Date: 2019/9/29-11:51 * Link: http://www.jackhhy.cn * Author: LuckyHhy * 版權所有: 2019~2022 [ LuckyHhy ] */ namespace Jrk; class Times { /** * @param $begin_time * @param $end_time * @return array * @author: hhygyl * @name: timediff * @describe:計算兩個時間戳之間相差的日時分秒 */ public static function timediff($begin_time,$end_time) { if($begin_time < $end_time){ $starttime = $begin_time; $endtime = $end_time; }else{ $starttime = $end_time; $endtime = $begin_time; } //計算天數 $timediff = $endtime-$starttime; $days = intval($timediff/86400); //計算小時數 $remain = $timediff%86400; $hours = intval($remain/3600); //計算分鐘數 $remain = $remain%3600; $mins = intval($remain/60); //計算秒數 $secs = $remain%60; $res = array("day" => $days,"hour" => $hours,"min" => $mins,"sec" => $secs); return $res; } /** * @param $date_time * @param int $type * @param bool $format * @return false|string * @author: hhygyl <hhygyl520@qq.com> * @name: format_datetime * @describe:友好的時間顯示 */ public static function friendlyDate($sTime, $type = 'normal', $alt = 'false'){ if (!$sTime) { return ''; } //sTime=源時間,cTime=當前時間,dTime=時間差 $cTime = time(); $dTime = $cTime - $sTime; $dDay = intval(date("z", $cTime)) - intval(date("z", $sTime)); //$dDay = intval($dTime/3600/24); $dYear = intval(date("Y", $cTime)) - intval(date("Y", $sTime)); //normal:n秒前,n分鐘前,n小時前,日期 if ($type == 'normal') { if ($dTime < 60) { if ($dTime < 10) { return '剛剛'; //by yangjs } else { return intval(floor($dTime / 10) * 10) . "秒前"; } } elseif ($dTime < 3600) { return intval($dTime / 60) . "分鐘前"; //今天的數據.年份相同.日期相同. } elseif ($dYear == 0 && $dDay == 0) { //return intval($dTime/3600)."小時前"; return '今天' . date('H:i', $sTime); } elseif ($dYear == 0) { return date("m月d日 H:i", $sTime); } else { return date("Y-m-d", $sTime); } } elseif ($type == 'mohu') { if ($dTime < 60) { return $dTime . "秒前"; } elseif ($dTime < 3600) { return intval($dTime / 60) . "分鐘前"; } elseif ($dTime >= 3600 && $dDay == 0) { return intval($dTime / 3600) . "小時前"; } elseif ($dDay > 0 && $dDay <= 7) { return intval($dDay) . "天前"; } elseif ($dDay > 7 && $dDay <= 30) { return intval($dDay / 7) . '周前'; } elseif ($dDay > 30) { return intval($dDay / 30) . '個月前'; } //full: Y-m-d , H:i:s } elseif ($type == 'full') { return date("Y-m-d , H:i:s", $sTime); } elseif ($type == 'ymd') { return date("Y-m-d", $sTime); } else { if ($dTime < 60) { return $dTime . "秒前"; } elseif ($dTime < 3600) { return intval($dTime / 60) . "分鐘前"; } elseif ($dTime >= 3600 && $dDay == 0) { return intval($dTime / 3600) . "小時前"; } elseif ($dYear == 0) { return date("Y-m-d H:i:s", $sTime); } else { return date("Y-m-d H:i:s", $sTime); } } } /** * @param StringService $timestamp * @return bool * @author: hhygyl * @name: is_timestamp * @describe:判斷是否是時間戳 */ public static function is_timestamp($timestamp ='') { if (!$timestamp) return false; return $is_unixtime = ctype_digit($timestamp) && $timestamp <= 2147483647; } /** * @param null $time * @param StringService $format * @return false|StringService * @author: hhygyl <hhygyl520@qq.com> * @name: time_format * @describe:時間戳格式化ibe: */ public static function time_format($time = NULL, $format = 'Y-m-d H:i') { $time = $time === NULL ? time() : intval($time); return date($format, $time); } /** * @param int $time * @return bool|StringService * @author: hhygyl <hhygyl520@qq.com> * @name: get_surplus_time * @describe:轉換剩余時間格式 */ public static function get_surplus_time($time = 0){ if (!$time) { return false; } if ($time < 0) { return '已結束'; } else { if ($time < 60) { return $time . '秒'; } else { if ($time < 3600) { return floor($time / 60) . '分鐘'; } else { if ($time < 86400) { return floor($time / 3600) . '小時'; } else { if ($time < 259200) {//3天內 return floor($time / 86400) . '天'; } else { return floor($time / 86400) . '天'; } } } } } } /** * @param $str_time * @param StringService $format * @return bool * @author: hhygyl <hhygyl520@qq.com> * @name: check_date_time * @describe:判斷是否日期時間 */ public static function check_date_time($str_time, $format="Y-m-d H:i:s") { $unix_time = strtotime($str_time); $check_date= date($format, $unix_time); if ($check_date == $str_time) { return true; } else { return false; } } /** * @param int $some * @param null $day * @return false|float|int|null * @author: hhygyl <hhygyl520@qq.com> * @name: get_some_day * @describe:獲取n天前0點的時間戳 */ public static function get_some_day($some = 30, $day = null) { $time = $day ? $day : time(); $some_day = $time - 60 * 60 * 24 * $some; $btime = date('Y-m-d' . ' 00:00:00', $some_day); $some_day = strtotime($btime); return $some_day; } } ~~~ `
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看