标签:tostring 获取时间戳 second highlight turn 时间戳 cond 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.TotalSeconds).ToString();  
}  
主要用的类:DateTime, TimeSpan
标签:tostring 获取时间戳 second highlight turn 时间戳 cond c# 如何
原文地址:http://www.cnblogs.com/shuai7boy/p/6013538.html