现在的位置: 首页 > 综合 > 正文

各种时间戳及用途

2012年05月23日 ⁄ 综合 ⁄ 共 415字 ⁄ 字号 评论关闭

        (一)

        /// <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;
        }

抱歉!评论已关闭.