C# gettime实现

TimeSpan ts=new TimeSpan(

 System.DateTime.UtcNow.Ticks - new DateTime(197011000).Ticks);   

(long)ts.TotalMilliseconds;  

或者:

   long timeSpan = (long)Math.Abs(DateTime.Now.Ticks - DateTime.Parse("1970-1-1").Ticks);
   timeSpan = timeSpan / TimeSpan.TicksPerMillisecond;
   timeSpan = timeSpan-28800000;//减去8小时时区差
   return timeSpan;

原文地址:https://www.cnblogs.com/harry0914/p/3245112.html