原地址:https://www.cnblogs.com/yixuehan/p/5559244.html
/// <summary> /// 时间戳转换成标准时间 /// </summary> /// <param name="timeStamp">时间戳</param> /// <returns></returns> private DateTime ConvertToTime(string timeStamp) { DateTime time = DateTime.Now; if (string.IsNullOrEmpty(timeStamp)) { return time; } try { DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); long lTime = long.Parse(timeStamp + "0000"); TimeSpan toNow = new TimeSpan(lTime); time = dtStart.Add(toNow); } catch (Exception ex) { log.Warn(ex.Message); } return time; }