C#时间戳转时间-时间转时间戳

        /// <summary>
        /// 时间戳转为C#格式时间
        /// </summary>
        /// <param name=”timeStamp”></param>
        /// <param name="bflag">为真时获取10位时间戳,为假时获取13位时间戳.</param>
        /// <returns></returns>
        private DateTime GetTime(string timeStamp, bool bflag = true)
        {
            DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(, , ));
            long lTime;
            if (bflag==true)
            {
                 lTime = ");
            }
            else{
                 lTime = ");
            }

            TimeSpan toNow = new TimeSpan(lTime); return dtStart.Add(toNow);
        }
        /// <summary>
        /// 获取当前时间戳
        /// </summary>
        /// <param name="bflag">为真时获取10位时间戳,为假时获取13位时间戳.</param>
        /// <returns></returns>
        public static string GetTimeStamp(bool bflag = true)
        {
            TimeSpan ts = DateTime.UtcNow - , , , , , , );
            string ret = string.Empty;
            if (bflag)
                ret = Convert.ToInt64(ts.TotalSeconds).ToString();
            else
                ret = Convert.ToInt64(ts.TotalMilliseconds).ToString();

            return ret;
        }
上一篇:Android ListVIew 详解(一)


下一篇:Session fixation--wiki