我想知道如果.NET包含了一个方法,当前时间,以秒或毫秒转换为UNIX时间戳(1970/1/1从偏移量)?
解决方案 时间跨度T =(DateTime.UtcNow - 新的日期时间(1970年,1,1));
Console.WriteLine((INT)t.TotalSeconds);
I am wondering if .NET contains a method to convert the current time in seconds or milliseconds to a UNIX timestamp (offset from 1970/1/1)?
解决方案TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));
Console.WriteLine((int)t.TotalSeconds);