标签:
1 /// <summary> 2 /// 时间戳转换成标准时间 3 /// </summary> 4 /// <param name="timeStamp">时间戳</param> 5 /// <returns></returns> 6 private DateTime ConvertToTime(string timeStamp) 7 { 8 DateTime time = DateTime.Now; 9 if (string.IsNullOrEmpty(timeStamp)) 10 { 11 return time; 12 } 13 try 14 { 15 DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)); 16 long lTime = long.Parse(timeStamp + "0000"); 17 TimeSpan toNow = new TimeSpan(lTime); 18 time = dtStart.Add(toNow); 19 } 20 catch (Exception ex) 21 { 22 log.Warn(ex.Message);
23 } 24 return time; 25 }
标签:
原文地址:http://www.cnblogs.com/yixuehan/p/5559244.html