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

  • 相关阅读:
    Sunnypig闯三角关
    送给圣诞夜的贺卡
    uva 1592(NEERC 2009 STL)
    uva 297(传递闭包 WF 1996)
    hdu 4190(二分)
    uva 3592 (MST, kruskal)
    uva 11997 (基础数据结构)
    hdu 2680 (Dijkstra)
    hdu 4568(状态压缩dp)
    hdu 4582 (树上的贪心)
  • 原文地址:https://www.cnblogs.com/shineqiujuan/p/1345751.html
Copyright © 2011-2022 走看看