zoukankan      html  css  js  c++  java
  • 10 把秒转换为天数,小时和分

    function secsToStr($secs)
    {
      if ($secs >= 86400) {
        $days = floor($secs / 86400);
        $secs = $secs % 86400;
        $r = $days . ' day';
        if ($days <> 1) {
          $r .= 's';
        }if ($secs > 0) {
          $r .= ', ';
        }
      }
      if ($secs >= 3600) {
        $hours = floor($secs / 3600);
        $secs = $secs % 3600;
        $r .= $hours . ' hour';
        if ($hours <> 1) {
          $r .= 's';
        }if ($secs > 0) {
          $r .= ', ';
        }
      }
      if ($secs >= 60) {
        $minutes = floor($secs / 60);
        $secs = $secs % 60;
        $r .= $minutes . ' minute';
        if ($minutes <> 1) {
          $r .= 's';
        }if ($secs > 0) {
          $r .= ', ';
        }
      }
      $r .= $secs . ' second';
      if ($secs <> 1) {
        $r .= 's';
      }
      return $r;
    }
    

      

  • 相关阅读:
    二级菜单实现
    Python监控日志中经常访问的ip
    Python判断一个数是否为小数
    Python-读写文件
    python-字典
    Python实现屏蔽敏感词
    Python生成随机密码
    Python-列表和元组
    Jmeter命令行参数
    启动Jmeter时遇到的几种错误
  • 原文地址:https://www.cnblogs.com/xin-jun/p/6952664.html
Copyright © 2011-2022 走看看