C#生成时间戳的方法

王佳亮

public static string GetTimeStamp()  
{  
    TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);  
    return Convert.ToInt64(ts.TotalSeconds).ToString();  
}  

2018-02-09 2499 views


Home