C#获取时间戳的几种方式
2021-03-18 05:24
标签:code div time() readline rsa write universal cno 方式 C#获取时间戳的几种方式 标签:code div time() readline rsa write universal cno 方式 原文地址:https://www.cnblogs.com/xiangxisheng/p/12364423.html Console.WriteLine(Convert.ToDouble(DateTime.UtcNow.Ticks - 621355968000000000) / (10 * 1000 * 1000));
TimeSpan ts1 = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
TimeSpan ts2 = new TimeSpan(DateTime.Now.ToUniversalTime().Ticks - 621355968000000000);
TimeSpan ts3 = new TimeSpan(DateTime.UtcNow.Ticks - 621355968000000000);
Console.WriteLine(ts1.TotalSeconds);
Console.WriteLine(ts2.TotalSeconds);
Console.WriteLine(ts3.TotalSeconds);
Console.ReadLine();