TimeSpan ts=new TimeSpan(
System.DateTime.UtcNow.Ticks - new DateTime(1970, 1, 1, 0, 0, 0).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;