#region 获取时间戳 /// <summary> /// 获取时间戳 /// </summary> /// <param name="ismilliseconds">是否获取毫秒时间戳</param> /// <returns></returns> public static long GetTimeStamp(bool ismilliseconds = false) { //时间戳 毫秒值 //var time = new DateTimeOffset(DateTime.UtcNow); var time = new DateTimeOffset(DateTime.Now); var timestamp = 0L; if (ismilliseconds) { timestamp = time.ToUnixTimeMilliseconds(); } else timestamp = time.ToUnixTimeSeconds(); return timestamp; } #endregion