/// <summary> /// 获取当前时间戳,10位,秒 /// </summary> /// <returns></returns> public string GetTimeStamp() { TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0); return Convert.ToInt64(ts.TotalSeconds).ToString(); } /// <summary> /// 获取时间戳,13位,毫秒 /// </summary> /// <returns></returns> public static string GetTimeStamps() { TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0); return Convert.ToInt64(ts.TotalMilliseconds).ToString(); }