10 位时间戳:
public static long GetTimeStampTen() { return (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000; }
13 位时间戳:
//当前时间转换13位时间戳 string datetimestr = DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds.ToString("F0"); Console.WriteLine("13位时间戳:" + datetimestr);
long类型的
public static long GetTimeStamp13() { return (long)DateTime.Now.ToUniversalTime().Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds; }
--