zoukankan      html  css  js  c++  java
  • 秒转换成年月日秒的算法

            public string ShowDateTime(string strSecond)
            {
                string strDate = string.Empty;
               
                if (strSecond != string.Empty)
                {
                    if (strSecond == "0")
                    {
                        return "在线用户,还没有退出.";
                    }
                    Int64 intSecond = Convert.ToInt64(strSecond);


                    // if(intSecond > 86400)
                    strDate = DateFormat(intSecond / 86400) + "天" + DateFormat((intSecond % 86400) / 3600) + "小时" + DateFormat((intSecond % 86400) % 3600 / 60) + "分钟" + DateFormat((intSecond % 86400) % 3600 % 60 % 60) + "秒";


                }
                return strDate;
            }

     private string DateFormat(long intNum)
            {
                string str;
                if (intNum > 9)
                    str = intNum.ToString();
                else
                    str = "0" + intNum.ToString();
                return str;
                //HttpUtility.UrlEncode(
            }

  • 相关阅读:
    自己写的一个后台模板
    php计算登陆时间差
    友盟推送,php简单代码
    rolling_curl curl批量采集函数留份
    PHP socket服务框架
    JS 画饼图,折线图
    jquery 日期插件
    JS 获取当前页面url,及锚点
    PHP 读取文件,返回二进制流
    各个数据库DataSource配置文件
  • 原文地址:https://www.cnblogs.com/shineqiujuan/p/1345751.html
Copyright © 2011-2022 走看看