C#:时间转换

 

1、C#时间转js时间

        /// <summary>
        /// C#时间转js时间
        /// </summary>
        /// <param name="theDate"></param>
        /// <returns></returns>
        private static long MilliTimeStamp(DateTime theDate)
        {
            var d1 = new DateTime(1970, 1, 1);
            var d2 = theDate.ToUniversalTime();
            var ts = new TimeSpan(d2.Ticks - d1.Ticks);
            return (long)ts.TotalMilliseconds;
        } 
View Code

 

posted @ 2016-11-23 11:21  慧由心生  阅读(571)  评论(0编辑  收藏  举报