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(
            }

  • 相关阅读:
    7. v-bind 绑定Class操作 【对象语法】
    7。 V-bind 绑定
    【离散化】
    【洛谷 1576】最小花费
    【洛谷 1078】文化之旅
    【POJ 2115】CLooooops
    【洛谷 1516】青蛙的约会
    【UOJ 270】电厂计划
    【UOJ 92】有向图的强联通分量
    【POJ 2186】Popular Cows
  • 原文地址:https://www.cnblogs.com/shineqiujuan/p/1345751.html
Copyright © 2011-2022 走看看