获取时间戳(毫秒级和秒级)
/// <summary> /// 获取时间戳 /// </summary> /// <param name="bflag">true 秒 , false 毫秒</param> /// <returns></returns> public static string GetTimeStamp(bool bflag) { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); string ret = string.Empty; if (bflag) ret = Convert.ToInt64(ts.TotalSeconds).ToString(); else ret = Convert.ToInt64(ts.TotalMilliseconds).ToString(); return ret; }