时间戳

//获取当前时间戳(都可以)
var timeStamp = (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000;
var UnixTimeStamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
//转换成年月日时分秒
DateTime dt = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
TimeSpan ts = new TimeSpan(long.Parse(UnixTimeStamp + “0000000”));
DateTime nowTime = dt.Add(ts);

DateTime dttt = DateTime.FromFileTime(132316673415625310);
Console.WriteLine(""+dttt+","+ dttt.ToString(“yyyyMMddHHmmss”));

你可能感兴趣的:(时间戳)