C# 获取时间戳

/// <summary>
/// 获取时间戳
/// </summary>
/// <returns></returns>
public static string GetTimeStamp()
{
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Convert.ToInt64(ts.TotalMilliseconds).ToString();
}

 

posted @ 2020-04-14 21:49  .net&new  阅读(942)  评论(0编辑  收藏  举报