zl程序教程

您现在的位置是:首页 >  后端

当前栏目

C#学习之获取时间戳

c#学习 获取 时间
2023-09-11 14:20:36 时间
/// <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.TotalSeconds).ToString();
}