各种时间戳及用途

        (一)

        /// <summary>
        /// 获得距离1970-01-01的毫秒数
        /// </summary>
        /// <param name="newDate">时间参数</param>
        /// <returns></returns>
        public static long GetMilliSecond(DateTime newDate)
        {
            DateTime oldDate = new DateTime(1970, 1, 1);

            // Difference in days, hours, and minutes.
            TimeSpan ts = newDate.ToUniversalTime() - oldDate;

            return (long)ts.TotalMilliseconds;
        }

posted on 2012-03-26 09:04  雨渐渐  阅读(281)  评论(0编辑  收藏  举报

导航